title: How can I make a UIScrollView image gallery? (iPhone SDK)
body: <p>I've been struggling with trying to get my UIImageView to change its image when the UIScrollView is scrolled, kind of like the Photos.app.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
      if (scrollView.contentOffset.x &gt; 296){
          self.currentDBNum++;
          self.currentDoorbell = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[[self.doorbells objectAtIndex:currentDBNum] objectForKey:@"Image"] ofType:@"jpg"]];
          self.doorbellPic.image = currentDoorbell;
          self.currentSoundPath = [[NSBundle mainBundle] pathForResource:[[doorbells objectAtIndex:currentDBNum] objectForKey:@"Sound"] ofType:@"caf"];
  
      }
  }
  </code></pre>
  
  <p>Any hints? Thanks. (The images have a width of 296.)</p>