Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable edit mode in particular cell ios?

i created tableview in editable mode all tableview rows are contain (-) symbol, but i need some cells are not under editable mode ,if it is possible, Thanks

like image 382
sabeer Avatar asked May 13 '13 05:05

sabeer


2 Answers

According to apple documentation of UITableViewDataSource https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewDataSource_Protocol/Reference/Reference.html

You can use tableView:canEditRowAtIndexPath:

like image 103
Deepesh Gairola Avatar answered Nov 19 '22 11:11

Deepesh Gairola


Yes reading the documentation will shed some light on this problem. The method in question that will help you is: tableView:canEditRowAtIndexPath:

This should get you headed in the right direction.

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {

    BOOL edit = NO;

    if(indexPath.row == 2) {

        edit = YES;
    }

    return edit;
}
like image 27
Dan Fairaizl Avatar answered Nov 19 '22 11:11

Dan Fairaizl