Reputation: 4637
I'm having the following problem.
I have an app using a UITableView with a custom UITableViewCell. Because of the specs of the app, I need it to be in edit mode always, so on the viewDidLoad I wrote this:
- (void)viewDidLoad
{
MainTableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"compose_background.png"]];
[MainTableView setAllowsSelectionDuringEditing: TRUE];
[MainTableView setEditing: TRUE];
[super viewDidLoad];
}
Also, I've implemented the following methods:
- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
- (BOOL) tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
- (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
And several more, but the problem persists and when I swipe a cell the delete button doesn't shows up. Any pointers would be highly appretiated.
Upvotes: 7
Views: 3706
Reputation: 6064
I don't think there is anyway for the standard swipe to delete to work while the table view is in editing mode, you'd have to respond to gestures and add your own delete button.
Upvotes: 1
Reputation: 9913
- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
must return UITableViewCellEditingStyleDelete
for each row you want to delete. Swipe-to-delete is disabled in favor of this method when in editing mode.
Upvotes: 10