Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Red minus sign is not appearing when I hit edit button

I did add this code to my viewDidLoad, the edit button showed up, but there is no minus button at the left side of the rows.

  self.navigationItem.leftBarButtonItem = self.editButtonItem;   

After swiping the row, the delete button shows up, but when I hit the edit button there is no minus sign.

What can cause the minus sign to not show up in my program?

like image 249
Bugra Baskaya Avatar asked Nov 28 '12 22:11

Bugra Baskaya


1 Answers

Set your table view editing mode as,

   [self.tableView setEditing:YES animated:YES];

do the above in the action method of your edit button in navigation bar.

Or just use,

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing:editing animated:animated];
    [self.tableView setEditing:editing animated:animated];
}

If you want to show the delete button, you can implement the below code.

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

     return UITableViewCellEditingStyleDelete;
}

For more details check the apple documentation

like image 65
iDev Avatar answered Oct 06 '22 20:10

iDev