title: How to Maintain Button State in UICollectionViewCell?
body: <p>I am using a UICollectionView and I have set a class for its cells.
  In the cell I have an image and a Like Button that when tapped it changes state (changes Button image). Note: my collectionView is shown horizontally and covers the entire screen.</p>
  
  <p><strong>My Problem:</strong> The cells are reusing and the like Buttons state is changed for every two cells. If I like image1 then image3, image5 and also change the Like Button. and if I like image2 then image4, image6 and so on change their state.</p>
  
  <p>I know this has to do with the reusing of cells. My question is how do I fix it so that each button is either unique or the state of the button is set to unselected in each cell.
  I have found similar question involving a UITableView but the answers don't seem to help me. So hopefully I'll find an answer here.</p>
  
  <p><strong>My code:</strong>
  Note: This is a DetailView so the data has been passed as a PFObject (Im using Parse.com Backend)</p>
  
  <pre><code>-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  
  return 1;
  
  }
  
  -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  
  return 10;
  
  }
  
  -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  
  static NSString *cellIdentifier = @"Cell";
  VestimentaDetailCell *cell = (VestimentaDetailCell *) [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
  
  cell.imageFile.image = [UIImage imageNamed:@"LoadLook.png"];
  
  PFFile *storeLooks = [self.vestimenta objectForKey:[NSString stringWithFormat:@"image_%ld", (long)indexPath.item]];
  
  [storeLooks getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
      if (!error &amp;&amp; data.length &gt; 0) {
  
          cell.imageFile.image = [UIImage imageWithData:data];
  
      } else {
  
          NSLog(@"No image found");
  
      }
  
  return cell;
  }
  </code></pre>
  
  <p><strong>VestimentaDetailCell.m</strong></p>
  
  <p>The Like Button has its action:</p>
  
  <pre><code>- (IBAction)likeLook:(id)sender {
  
      if ([sender isSelected]) {
          [sender setImage:[UIImage imageNamed:@"Like.png"] forState:UIControlStateNormal];
          [sender setSelected:NO];
  
  
      } else {
          [sender setImage:[UIImage imageNamed:@"Liked.png"] forState:UIControlStateSelected];
          [sender setSelected:YES];
  
          UIImageView *like = [[UIImageView alloc] initWithFrame:CGRectMake(120, 220, 100, 100)];
          like.image = [UIImage imageNamed:@"Love.png"];
          [self addSubview:like];
          [UIView animateWithDuration:2 animations:^{like.alpha = 0.0;}];
  
          NSLog(@"Liked Image");
  
  }
  }
  </code></pre>