Guest User

Untitled

a guest
May 23rd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. @implementation PrefViewController
  2.  
  3. [array release];
  4. [super viewDidLoad];
  5.  
  6. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  7. static NSString *CheckMarkCellIdentifier = @"CheckMarkCellIdentifier";
  8. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CheckMarkCellIdentifier];
  9.  
  10. NSUInteger row = [indexPath row];
  11. NSUInteger oldRow = [lastIndexPath row];
  12.  
  13. if(indexPath.section == 1)
  14. {
  15. if (cell == nil)
  16. {
  17. cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CheckMarkCellIdentifier] autorelease];
  18. if (indexPath.row == 0)
  19. cell.accessoryType = UITableViewCellAccessoryCheckmark;
  20. }
  21.  
  22. cell.text = [listData objectAtIndex:row];
  23. cell.accessoryType = (row == oldRow && lastIndexPath != nil) ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
  24. }
  25. else
  26. {
  27. if (cell == nil)
  28. {
  29. cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CheckMarkCellIdentifier] autorelease];
  30. }
  31.  
  32. cell.text = [aboutData objectAtIndex:row];
  33. cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  34. }
  35.  
  36. return cell;
  37.  
  38. if (indexPath.row == 0)
  39. cell.accessoryType = UITableViewCellAccessoryCheckmark;
  40.  
  41. if (cell.accessoryType == UITableViewCellAccessoryNone) {
  42. cell.accessoryType = UITableViewCellAccessoryCheckmark;
  43. }
  44. else if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
  45. cell.accessoryType = UITableViewCellAccessoryNone;
  46. }
Add Comment
Please, Sign In to add comment