I believe you are looking for a UIScrollView , and pagingEnabled for YES. You can leave scrollview as a view above a regular UITabBar. You will use UIPageControl to get small dots. You can update it programmatically when the UIScrollView scrolls to the page, implementing the appropriate scroll delegate method, possibly -scrollViewDidScroll :.
Suppose you have two ivars: scrollView and pageControl. When you know how many pages will be displayed in your scroll, you can set contentSize for scrollView. It must be a multiple of the scrollView bounds. For example, if the number of pages is static, you can copy it to your -viewDidLoad ...
- (void)viewDidLoad { // Any other code. scrollView.pagingEnabled = YES; scrollView.contentSize = CGSizeMake(scrollView.bounds.size.width * 3, scrollView.bounds.size.height); // 3 pages wide. scrollView.delegate = self; }
Then, to update your little dots ...
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat pageWidth = scrollView.bounds.size.width; NSInteger pageNumber = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1; pageControl.currentPage = pageNumber; }
Matt wilding
source share