Set UIPageControll scroll view current page


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. - (void)scrollViewDidScroll:(UIScrollView *)_scrollView
  2. {
  3. CGFloat pageWidth = _scrollView.frame.size.width;
  4.  
  5. int page = floor((_scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
  6.  
  7. self.pageControl.currentPage = page;
  8. }

Report this snippet


Comments


You need to login to view comments.