title: IOS Change Accessory View Cell Image in Uitableview based on NSMutableArray value
body: <p>I have a <code>UITableview</code> That I display a list of users and their profile pictures. On the right hand side of the <code>UITableview</code> I have added a image for the Cell Accessory View.</p>
  
  <p>I have a <code>NSMutableArray</code> "isFollowingLeader" that has 2 different values in it. 0 and 1 being the values stored in my array.</p>
  
  <p>I want to be able to change or set the <code>cell.accessoryView</code> based on the isFollowingLeader array.</p>
  
  <p>So If the isFollowingLeader array is 0 at index path of <code>UITableview</code> I want to set the image of the <code>cell.accessoryView</code> to my image of ic_add_contact.png at index path of <code>UITableview</code> and if the array is 1 at index path I want to show ic_checkmark_square.png</p>
  
  <pre><code>isFollowingLeader Array in NSlog (
  1,
  0,
  0,
  0,
  1,
  0,
  0,
  0
  )
  
  self.isFollowingLeader = [NSMutableArray arrayWithArray:[prefs arrayForKey:@"piccingFollowerisLeader"]];
  
  
  if ([self.isFollowingLeader objectAtIndex:[indexPath row]] == 0) {
  
      // Sets the image for the  Accessory View for cell
      UIImageView *arrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_add_contact.png"]];
      cell.accessoryView = arrow;
  }
  
  else  {
  
      // Sets the image for the  Accessory View for cell
      UIImageView *arrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_checkmark_square.png"]];
      cell.accessoryView = arrow;
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/gRe0F.png" alt="enter image description here"></p>