页面控制指示符不跟随滚动视图。我尝试了两个: - 没有任何作用..我做错了什么?
-(void) scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat pageWidth = self.scroller.frame.size.width;
int page = floor((self.scroller.contentOffset.x - pageWidth/2)/ pageWidth)+1;
self.pageControl.currentPage=page;
}
-(void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
int page = scrollView.contentOffset.x / scrollView.frame.size.width;
self.pageControl.currentPage = page;
}
答案 0 :(得分:1)
我认为您不需要在方法-(void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView