title: iOS development Animating Table view custom cell content
body: <p>I am working on new application and i would like to have custom table view. I need to have cell that have 2 labels 1 check box and 2 buttons. The problem i have is that 2 buttons need to be shown only if user press edit button on top. I made all this to work but i have some problem with reusable cells or something like that.</p>
  
  <p>I made custom cell class so i can assign data to it.</p>
  
  <p>First state is: First state on img</p>
  
  <p>Then when user press edit button on top i need everyting to animate and come to right place.
  I want text to animate to right to make space for button, delete button needs to come animated from left side and edit butom to come in animated from right side.</p>
  
  <p>This is what i want to get after animations are done: Second state on img</p>
  
  <p>I made all this to work but now i have problem that first 2 cells that will come on screen after i scroll down are not effected by my code :(</p>
  
  <p>This is what i get: Third state on img</p>
  
  <p>i will post my project code here and if some1 can help me with it i would be more then thrilled. I point me to right way to do this.</p>
  
  <p>Code downoald: <a href="https://www.mediafire.com/?g1g6d7h33mpkyt7" rel="nofollow">https://www.mediafire.com/?g1g6d7h33mpkyt7</a></p>
  
  <p>and i will post some code here that i think is crucial to my problem:</p>
  
  <p>for animations i use:</p>
  
  <pre><code>[cell.infoView setFrame:CGRectMake(20, CGRectGetMinY(cell.infoView.frame), CGRectGetWidth(cell.infoView.frame), CGRectGetHeight(cell.infoView.frame))];
          [UIView animateWithDuration:0.4
                                delay:0
                              options:UIViewAnimationOptionCurveEaseIn
                           animations:^{
                               [cell.infoView setFrame:CGRectMake(70, CGRectGetMinY(cell.infoView.frame), CGRectGetWidth(cell.infoView.frame), CGRectGetHeight(cell.infoView.frame))];
                           }
                           completion:nil];
  </code></pre>
  
  <p>for cell init i use:</p>
  
  <pre><code>CICustomCell *cell;
  cell = [tableView dequeueReusableCellWithIdentifier:CellTableIdentifier];
  if(cell == nil)
  {
      NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"HCICustomCell" owner:nil options:nil];
      cell = [nib objectAtIndex:0];
  }
  
  cell.itemName = [dwarves objectAtIndex:indexPath.row];
  
  cell.quantity = 25.99;
  </code></pre>
  
  <p>for table init i use:</p>
  
  <pre><code>UITableView *tableView = (id)[self.view viewWithTag:1];
  
  tableView.rowHeight = 60;
  
  UINib *nib = [UINib nibWithNibName:@"HCICustomCell"
                              bundle:nil];
  
  
  [tableView registerNib:nib forCellReuseIdentifier:CellTableIdentifier];
  </code></pre>
  
  <p>img: <a href="http://i270.photobucket.com/albums/jj109/lazardj/scsimg.jpg~original" rel="nofollow">http://i270.photobucket.com/albums/jj109/lazardj/scsimg.jpg~original</a></p>
  
  <p>EDIT:</p>
  
  <p>I also tried something now. If i start my activity then scroll down a bit so i get some new cells i dont have this problem. So it must be something with creating cells or reusability of cells or something like that. I am new to ios development so i cant figure this out on my own :( so please help :) Thanks</p>