title: How to create a paging scrollView with space between views
body: <p>I followed the tutorial about how to create a scrollView Page Control: <a href="http://www.iosdevnotes.com/2011/03/uiscrollview-paging/" rel="nofollow">http://www.iosdevnotes.com/2011/03/uiscrollview-paging/</a></p>
  
  <p>This tutorial is really good and I implement well the code. Here my question:</p>
  
  <p>I want to put a space between the my PageViews, but when it change the page it show the space between the views in the next page. The scroll must stop after the space when I change the page. </p>
  
  <p>I changed the tutorial code here:</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
      NSArray *colors = [NSArray arrayWithObjects:[UIColor redColor], [UIColor greenColor], [UIColor blueColor], nil];
  
      #define space 20
  
      for (int i = 0; i &lt; colors.count; i++) {
          CGRect frame;
          frame.origin.x = (self.scrollView.frame.size.width + space) * i;
          frame.origin.y = 0;
          frame.size = self.scrollView.frame.
  
          UIView *subview = [[UIView alloc] initWithFrame:frame];
          subview.backgroundColor = [colors objectAtIndex:i];
          [self.scrollView addSubview:subview];
          [subview release];
      }
  
      self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * colors.count+ space*(colors.count-1), self.scrollView.frame.size.height);
  }
  </code></pre>