aqavi_paracha
aqavi_paracha

Reputation: 1131

iphone, disable table sliding in edit mode

hi I am editing table view in iphone. I m doing this with the following code written under viewDidLoad() method.

UIBarButtonItem* barBtnItemEdit = self.navigationItem.rightBarButtonItem = 
  [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit 
                                                target:self 
                                                action:@selector(turnOnEditing)];

My table view goes in edit mode correctly, but it slides a little to the right. Now what i want to do is to lock the table so that it remains on its position even in edit mode. I am writing customized code for table in editing mode instead of default Delete or insert behavior..

I've implemented the following code to stop displaying "red-color delete" button in front of each row...,

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{ 
   return UITableViewCellEditingStyleNone;
}

but UITableVIew still slides a little to the right. Now how to lock the table so that it doesn't change its position in edit mode

Best regards, Abdul Qavi

Upvotes: 1

Views: 639

Answers (1)

Jilouc
Jilouc

Reputation: 12714

I think you also need to add:

- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    return NO;
}

Upvotes: 5

Related Questions