Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. - (void)setEditing:(BOOL)flag animated:(BOOL)animated{
  2.  
  3. int count = [streams count];
  4.  
  5.  
  6. UITableView *tableView = (UITableView *)self.view;
  7. NSArray *topIndexPath = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:count inSection:0]];
  8.  
  9. if (self.editing == YES)
  10. {NSLog(@"EDITING");
  11. [tableView insertRowsAtIndexPaths:topIndexPath withRowAnimation:UITableViewRowAnimationBottom];}
  12.  
  13. else{NSLog(@"NOT EDITING");
  14. [tableView deleteRowsAtIndexPaths:topIndexPath withRowAnimation:UITableViewRowAnimationBottom];}
  15.  
  16.  
  17. }
  18.  
  19. - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
  20.  
  21. int count = [streams count];
  22. int row = indexPath.row ;
  23.  
  24. if (row == count)
  25.  
  26. return UITableViewCellEditingStyleInsert;
  27.  
  28. else
  29.  
  30. return UITableViewCellEditingStyleDelete;}
  31.  
  32. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  33.  
  34. static NSString *DeleteMeCellIdentifier = @"AudioCellIdentifier";
  35.  
  36. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
  37. DeleteMeCellIdentifier];
  38. if (cell == nil) {
  39. cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
  40. reuseIdentifier:DeleteMeCellIdentifier] autorelease];
  41. }
  42. int x = indexPath.row;
  43. if (self.editing == YES)
  44. {
  45. if (indexPath.row == [streams count])
  46.  
  47. cell.textLabel.text = @"Add Phone Number";
  48.  
  49. else
  50. cell.textLabel.text = [self.streams objectAtIndex:indexPath.row];
  51. }
  52. else
  53. {
  54. cell.textLabel.text = [self.streams objectAtIndex:indexPath.row];
  55. }
  56.  
  57. return cell;}
  58.  
  59. - (void)viewWillDisappear:(BOOL)animated {
  60.  
  61. Disc *disc = [Disc sharedDisc];
  62. [disc.streams insertObject:@"0208" atIndex:0];
  63. [super viewDidAppear:animated];}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement