title: Image array Iphone
body: <p>I want to change the image in an imageview at the click of a button.</p>
  
  <p>Sample code:</p>
  
  <pre><code>NSMutableArray *array = [[NSMutableArray alloc]init];
  
  [array addObject:[UIImage imageNamed:@"pic1.png"]];
  [array addObject:[UIImage imageNamed:@"pic2.png"]];
  [array addObject:[UIImage imageNamed:@"pic3.png"]];
  
  NSLog(@"%i" , [array count]);
  
  for (int i = 0; i &lt; [array count]; i++) {
      [type setImage:[array objectAtIndex:i]];
  }
  </code></pre>
  
  <p>When I click the button, it displays pic3 and nothing else. Can anyone point me in the right direction?</p>