Hi all,
This may be a simple problem. I have a UIScrollView with 3 views. I need to display 3 dots like Indicator ( to indicate there are more pages to the user). How do i do this?
Thanks
Hi all,
This may be a simple problem. I have a UIScrollView with 3 views. I need to display 3 dots like Indicator ( to indicate there are more pages to the user). How do i do this?
Thanks
use a UIPageControl:
pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(...)]; // set in header
[pageControl setNumberOfPages:3];
[pageControl setCurrentPage:0];
[pageControl setBackgroundColor:[UIColor clearColor]];
[self.view addSubview:pageControl];
That is the UI component that shows the dots... the number of pages is the number of dots. The current page is the one that is currently highlighted.
Then you need to use the scroll view delegate method to determine what 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];
}
You can use a UIPageControl with 3 dots on it. You'll need screen space (assuming the bottom of the screen) to put the page control so your scrollview won't be able to be full height.
Hi, You could create contentView in which you add UIScrollView and UIPageControl, set numberOfPages of pageControl to selected count and when you scroll you change page in your pageControl ( currentPage property ).
Cheers, Krzysztof Zabłocki