How to limit the delete option for first row in UITableView
HI In my appliacatio开发者_JAVA百科n I want deletion control button will not work for first row except for all other rows.
Please can anybody tell me how it would be possible.
Thanks
Implement editingStyleForRowAtIndexPath method in table delegate and return style value depending on cell's index:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
//Disable editing for 1st row in section
return (indexPath.row == 0) ? UITableViewCellEditingStyleNone : UITableViewCellEditingStyleDelete;
}
精彩评论