Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 1.02 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. adjusting UITableView's cell at runtime
  2. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  3. {  
  4. MyCell* cell = (MyCell *) [self.table cellForRowAtIndexPath:indexPath];
  5. UIView * options = [[UIView alloc] initWithFrame:CGRectMake(0, cell.frame.size.height - 27, cell.frame.size.width, 27)];
  6. UIButton* button1 = [UIButton buttonWithType:UIButtonTypeCustom];
  7. [options addSubview:button1];
  8. UIButton* button2 = [UIButton buttonWithType:UIButtonTypeCustom];
  9. [options addSubview:button2];
  10. UIButton* button3 = [UIButton buttonWithType:UIButtonTypeCustom];
  11. [options addSubview:button3];
  12. //did some layout calculation here to position the button
  13. [cell addSubview:options];
  14. }
  15.        
  16. MyCell * cell = (MyCell *)[self.table cellForRowAtIndexPath:temp];
  17.      [cell.accessoryView removeFromSuperview];
  18.      cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  19.        
  20. [tableView beginUpdates];
  21. [tableView endUpdates];
  22.        
  23. insertRowsAtIndexPaths:withRowAnimation:
  24.        
  25. deleteRowsAtIndexPaths:withRowAnimation: