snksnk
snksnk

Reputation: 1595

UIPageControl does not show current page

Page Control indicator does not follow with scroll view.I tried both: -and nothing works.. what am I doing wrong?

-(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;

}

Upvotes: 0

Views: 1563

Answers (1)

tiguero
tiguero

Reputation: 11537

I don't think you need to specify your currentPage within the method -(void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView

Upvotes: 1

Related Questions