iphone - using UIScrollView generating issues -
this may simple problem. have uiscrollview 3 views. need display 3 dots indicator ( indicate there more pages user). how do this?
use uipagecontrol:
pagecontrol = [[uipagecontrol alloc] initwithframe:cgrectmake(...)]; // set in header [pagecontrol setnumberofpages:3]; [pagecontrol setcurrentpage:0]; [pagecontrol setbackgroundcolor:[uicolor clearcolor]]; [self.view addsubview:pagecontrol];
that ui component shows dots... number of pages number of dots. current page 1 highlighted.
then need use scroll view delegate method determine page you've scrolled to:
- (void)scrollviewdidenddecelerating:(uiscrollview *)scrollview{ int newoffset = scrollview.contentoffset.x; int newpage = (int)(newoffset/(scrollview.frame.size.width)); [pagecontrol setcurrentpage:newpage]; }
Comments
Post a Comment