title: Scrollview not loading additional Images
body: <p>I have a UIView that I am using as a simple onboarding view. I simply shows <code>n</code> images, that the user can swipe through.  </p>
  
  <p>The only image that loads is the very first image "OnBoard-1". The other images are there when I debug the what is being added to the image view.</p>
  
  <p><a href="https://i.stack.imgur.com/xMjEP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xMjEP.png" alt="enter image description here"></a></p>
  
  <p>What am I doing wrong?</p>
  
  <p>.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  @interface OnBoardingView : UIView 
  - (void)setImages:(NSArray *)newImages;
  @end
  </code></pre>
  
  <p>Here is the .m file</p>
  
  <pre><code>#import "OnBoardingView.h"
  
  @interface OnBoardingView () &lt;UIScrollViewDelegate&gt;
  {
      UIPageControl *pageControl;
      NSArray *contentImages;
  }
  @property (nonatomic, retain) UIPageControl *pageControl;
  @property (nonatomic, retain) NSArray       *contentImages;
  @end
  
  
  
  @implementation OnBoardingView
  
  
  @synthesize pageControl;
  @synthesize contentImages;
  
  
  - (id) initWithFrame:(CGRect)frame {
      self = [super initWithFrame:frame];
      if (self) { }
      return self;
  }
  
  #pragma mark - Override contentImages setter
  
  - (void)setImages:(NSArray *)newImages {
      if (newImages != self.contentImages) {
          self.contentImages = newImages;
          [self setup];
      }
  }
  
  #pragma mark - Carousel setup
  
  - (void)setup {
      UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.frame];
      [scrollView setDelegate:self];
      [scrollView setShowsHorizontalScrollIndicator:NO];
      [scrollView setPagingEnabled:YES];
      [scrollView setBounces:NO];
  
      CGSize scrollViewSize = scrollView.frame.size;
  
      for (NSInteger i = 0; i &lt; [self.contentImages count]; i++) {
          CGRect slideRect = CGRectMake(scrollViewSize.width * i, 0, scrollViewSize.width, scrollViewSize.height);
  
          UIView *slide = [[UIView alloc] initWithFrame:slideRect];
          [slide setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0]];
  
          UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.frame];
          [imageView setImage:[UIImage imageNamed:[self.contentImages objectAtIndex:i]]];
          NSLog(@"Image named: %@", [self.contentImages objectAtIndex:i]);
          [slide addSubview:imageView];
  
          [scrollView addSubview:slide];
  
      }
  
      UIPageControl *tempPageControll = [[UIPageControl alloc] initWithFrame:CGRectMake(0, scrollViewSize.height - 20, scrollViewSize.width, 20)];
      [self setPageControl:tempPageControll];
  
      [self.pageControl setNumberOfPages:[self.contentImages count]];
      [scrollView setContentSize:CGSizeMake(scrollViewSize.width * [self.contentImages count], scrollViewSize.height)];
  
      [self addSubview:scrollView];
  
      [self addSubview:self.pageControl];
  }
  
  #pragma mark - UIScrollViewDelegate
  
  - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
      CGFloat pageWidth = scrollView.frame.size.width;
      int page = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
      [self.pageControl setCurrentPage:page];
  }
  
  @end
  </code></pre>