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.viewaddSubview:sc];
for(inti =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 =[NSArrayarrayWithObjects:@"1",@"2",@"3",nil];
img.image=[UIImageimageNamed:arr[i]];
[scaddSubview:img];
}
网友评论