title: static and dynamic objects in uiscrollview
body: <p>I have some issue. i want to show static and dynamic objects in scrollview. i've IBOutlets and they are connected. I want to change the message and title, they are created manually in code. All others objects are static. My code is here: </p>
  
  <p>.h file:</p>
  
  <pre><code>@interface MessageContentViewController (){
      IBOutlet UIImageView  *avatarImageView;
      IBOutlet UIScrollView *scrollView;
      IBOutlet UIImageView  *msgBoardImg;
      IBOutlet UIImageView  *topBarImg;
      IBOutlet UIButton     *backBtn;
      NSMutableArray *allMessages;
  }
  
  @property int indexOfMsg;
  
  @end
  </code></pre>
  
  <p>.m file:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"background.jpg"]]];
  
      [self.navigationController setNavigationBarHidden:YES animated:YES];
      [scrollView setContentSize:CGSizeMake(scrollView.frame.size.width * allMessages.count, 0)];
      [scrollView setPagingEnabled:YES];
  
      [scrollView scrollRectToVisible:CGRectMake(scrollView.frame.size.width * indexOfMsg, scrollView.frame.origin.y, scrollView.frame.size.width, scrollView.frame.size.height) animated:NO];
      for (int i = 0; i &lt; allMessages.count; i++) {
  
          UIView *tempSubView = [[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width * i, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height)];
          [tempSubView addSubview:topBarImg];
          [tempSubView addSubview:backBtn];
          [tempSubView addSubview:msgBoardImg];
          [tempSubView addSubview:avatarImageView];
          [scrollView addSubview:tempSubView];
      }
  
      [scrollView setContentOffset: CGPointMake(scrollView.frame.size.width * indexOfMsg, 0)];
  
      CGRect currentViewFrame = CGRectMake(scrollView.frame.size.width * indexOfMsg, scrollView.frame.origin.y, scrollView.frame.size.width, scrollView.frame.size.height);
      [scrollView scrollRectToVisible:currentViewFrame animated:NO];
  
  }
  </code></pre>
  
  <p>.xib file:</p>
  
  <p><img src="https://i.stack.imgur.com/efiEU.png" alt="enter image description here"></p>
  
  <p>Please help me. Thanks in advance.</p>