I have made a scroll view with 3 pages. It's 960x460 pixels, exactly 3 pages. I made it using Interface Builder and linked it up.
Paging is working perfectly. There is a nice smooth scroll between pages.
However, I would like to get UIPageControl working as well, to show which page the user is on and give them another scrolling option. I cannot for the life of me figure out how the apple example works. They don't even have a scroll view or a UIPageControl in their nib file as far as I can tell! What kind of witchcraft is this?!
I want to hook the UIPageControl into my scrollview using interface builder if possible. It doesn't need to handle infinite pages or anything crazy like that, just the 3 I already have.
Code:
.h
@interface PagingTestViewController : UIViewController {
IBOutlet UIScrollView *scrollView;
IBOutlet UIPageControl *pageControl;
}
@end
.m
- (void)viewDidLoad {
[super viewDidLoad];
[scrollView setContentSize:CGSizeMake(960, 460)];
[scrollView setClipsToBounds:YES];
scrollView.backgroundColor = [UIColor blackColor];
scrollView.scrollEnabled = YES;
scrollView.pagingEnabled = YES;
scrollView.bounces = YES;
scrollView.directionalLockEnabled = YES;
}
Is there an easy way this can be done?