滚动试图
//初始化滚动视图
scrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0,self.view.frame.size.width,120)];
//设置滚动范围
scrollV.contentSize = CGSizeMake(self.view.frame.size.width *3,120);
//设置代理
scrollV.delegate=self;
//设置是否分页
scrollV.pagingEnabled=YES;
//取消弹簧效果
scrollV.bounces =NO;
//取消滑动
scrollV.showsHorizontalScrollIndicator=NO;
//添加到视图
[tbv addSubview:scrollV];
for(inti =0; i<3; i++) {
UIImageView * imgV = [[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width * i,0,self.view.frame.size.width,160)];
imgV.image = [UIImage imageNamed:arr[i]];
[scrollV addSubview:imgV];
}
page = [[UIPageControl alloc]initWithFrame:CGRectMake((self.view.frame.size.width-150)/2,130,150,30)];
//设置点数
page.numberOfPages =3;
//设置颜色
page.pageIndicatorTintColor = [UIColor blackColor];
//设置滑过颜色
page.currentPageIndicatorTintColor = [UIColor whiteColor];
//添加到视图
[tbv addSubview:page];
return cell;
//滚动视图偏移量
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
page.currentPage = scrollV.contentOffset.x/self.view.frame.size.width;
}