正版滚动

UIScrollView *sc =[[UIScrollView alloc] initWithFrame:CGRectMake(0, 67, self.view.frame.size.width, 200)];
    sc.showsVerticalScrollIndicator= NO;
    self.view.backgroundColor = [UIColor whiteColor];
    sc.showsHorizontalScrollIndicator = NO;
    sc.contentSize = CGSizeMake(self.view.frame.size.width *3 , 0);
    sc.pagingEnabled = YES;
    sc.userInteractionEnabled = YES;
    [self.view addSubview:sc];
    for (int i = 0; i<3; i++) {
        UIImageView *img =[[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width * i,0 , self.view.frame.size.width , 200)];
        NSArray *arr =[NSArray arrayWithObjects:@"1",@"2",@"3", nil];
        img.image =[UIImage imageNamed:arr[i]];
        [sc addSubview:img];
         
}

你可能感兴趣的:(正版滚动)