title: change UIButton image with array
body: <p>novice need help! idea: when you press the button you need to change the image of the array. Yes, I'm stupid.</p>
  
  <p>from <i>*.h:</i></p>
  
  <pre><code>{
      NSMutableArray *_cat;
      NSInteger _catindex;
  }
  
  @property (weak, nonatomic) IBOutlet UIButton *catbtn;
  
  - (IBAction)catbutton:(id)sender;
  </code></pre>
  
  <p>from <i>*.m:</i>`</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      _cat = [NSMutableArray array];
  
      UIImage *cat1 = [UIImage imageNamed:@"cat1.png"];
      UIImage *cat2 = [UIImage imageNamed:@"cat2.png"];
      UIImage *cat3 = [UIImage imageNamed:@"cat3.png"];
      UIImage *cat4 = [UIImage imageNamed:@"cat4.png"];
      UIImage *cat5 = [UIImage imageNamed:@"cat5.png"];
      [_cat addObject:cat1];
      [_cat addObject:cat2];
      [_cat addObject:cat3];
      [_cat addObject:cat4];
      [_cat addObject:cat5];
  
      self.catbtn.image = [_cat objectAtIndex:_catindex];
  
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (IBAction)catbutton:(id)sender
  {
      _catindex++;
      if (_catindex == _cat.count)
      {
          _catindex = 0;
      }
      self.catbtn.image = [_cat objectAtIndex:_catindex];
  
  }
  </code></pre>
  
  <p>I do not know whether it is possible to do that, but I hope for your help.</p>