title: Page Control not changing when scroll view scrolls
body: <p>I am trying to add a page control to my scroll view, and have followed numerous web tutorials, the majority which use the same code as this <a href="http://www.edumobile.org/iphone/iphone-programming-tutorials/pagecontrol-example-in-iphone/" rel="nofollow noreferrer">tutorial.</a> However, once I place the code into my project, even with me making changes to the code to try to make it work, it just doesn't. I have managed to make the code work for when the page control is pressed, however it just won't work for the page scrolling. My issue is similar to <a href="https://stackoverflow.com/questions/4037416/scrollview-pagecontrol-dot-doesnt-change-with-the-page">this</a>, although the answers are of no help. Here is my code:</p>
  
  <p>MainViewController.h</p>
  
  <pre><code>@interface MainViewController : UIViewController
  {
  UIScrollView *svCollegeMain;
  UIScrollView *svCollegePage;
  UIPageControl *pcCollege;
  UIView *viewP1;
  }
  
  @property (nonatomic, retain) IBOutlet UIScrollView* svCollegeMain;
  @property (nonatomic, retain) IBOutlet UIScrollView* svCollegePage;
  @property (nonatomic, retain) IBOutlet UIPageControl * pcCollege;
  - (IBAction)changePage;
  
  @end
  </code></pre>
  
  <p>and MainViewController.m</p>
  
  <pre><code>@implementation MainViewController
  
  @synthesize svCollegeMain, svCollegePage, pcCollege;
  
  - (void)viewDidLoad 
  {
  [super viewDidLoad];
  self.svCollegeMain.contentSize = CGSizeMake(960, 332);
  self.svCollegePage.contentSize = CGSizeMake(320, 500);
  }
  
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  if (self) {
      // Custom initialization
  }
  return self;
  }
  
  - (void)didReceiveMemoryWarning
  {
  // Releases the view if it doesn't have a superview.
  [super didReceiveMemoryWarning];
  
  // Release any cached data, images, etc that aren't in use.
  }
  
  - (void)scrollViewDidScroll:(UIScrollView *)sender
  {
  CGFloat pageWidth = 320;
  int page = floor((svCollegeMain.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
  pcCollege.currentPage = page;
  }
  
  - (IBAction)changePage 
  {
  CGRect frame;
  frame.origin.x = self.svCollegeMain.frame.size.width * self.pcCollege.currentPage;
  frame.origin.y = 0;
  frame.size = self.svCollegeMain.frame.size;
  [self.svCollegeMain scrollRectToVisible:frame animated:YES];
  }
  
  #pragma mark - View lifecycle
  
  - (void)viewDidUnload
  {
  [super viewDidUnload];
  self.svCollegeMain = nil;
  self.svCollegePage = nil;
  self.pcCollege = nil;
  // Release any retained subviews of the main view.
  // e.g. self.myOutlet = nil;
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
  // Return YES for supported orientations
  return (interfaceOrientation == UIInterfaceOrientationPortrait);
  }
  
  @end
  </code></pre>
  
  <p>Just incase this makes any difference, my view is set out with a view, then a main scroll view and page control within this view, another view and scroll view (next to each other) within the main scroll view, and finally a final view in the second scroll view (all in IB, did not want too much code), and everything is linked up in IB.</p>