I have a UIScrollView containing 5 images. I want to add a UIPageControl at the bottom of my scroll view so that the user can see what page they are on.
Here is my code for the scroll view:
self.helpScrollView.contentSize = CGSizeMake(320 * 5, 436);
UIImageView *image1 = [[UIImageView alloc] initWithFrame:CGRectMake(320 * 0, 0, 320, 436)];
image1.image = [UIImage imageNamed:[NSString stringWithFormat:
@"Guide Page One.png"]];
[self.helpScrollView addSubview:image1];
UIImageView *image2 = [[UIImageView alloc] initWithFrame:CGRectMake(320 * 1, 0, 320, 436)];
image2.image = [UIImage imageNamed:[NSString stringWithFormat:
@"Guide Page Two.png"]];
[self.helpScrollView addSubview:image2];
UIImageView *image3 = [[UIImageView alloc] initWithFrame:CGRectMake(320 * 2, 0, 320, 436)];
image3.image = [UIImage imageNamed:[NSString stringWithFormat:
@"Guide Page Three.png"]];
[self.helpScrollView addSubview:image3];
UIImageView *image4 = [[UIImageView alloc] initWithFrame:CGRectMake(320 * 3, 0, 320, 436)];
image4.image = [UIImage imageNamed:[NSString stringWithFormat:
@"Guide Page Four.png"]];
[self.helpScrollView addSubview:image4];
UIImageView *image5 = [[UIImageView alloc] initWithFrame:CGRectMake(320 * 4, 0, 320, 436)];
image5.image = [UIImage imageNamed:[NSString stringWithFormat:
@"Guide Page Five.png"]];
[self.helpScrollView addSubview:image5];
self.helpScrollView.pagingEnabled = true;
self.helpScrollView.showsHorizontalScrollIndicator = NO;
I have dragged a UIPageControl onto my scrollview in my xib file, but I don't know how to link them. How do I do this?