views:

50

answers:

1

Hi guys,

Here I need a help from ur side that Im using the tableview delegate method commitEditing sytle to get the delete button for every cell when we swipe.But my problem here is I dont want the delete button for the first row in the tableview and swipe should not work and I dnt have any idea how to implemet this.

Anyone's help will be much appreciated.

Thank You,

Monish.

+1  A: 

UITableViewCell has delete style by default. To change that you need to implement tableView:editingStyleForRowAtIndexPath: method in your table view delegate. Return UITableViewCellEditingStyleNone for the 1st row and UITableViewCellEditingStyleDelete for other rows.

Edit: Sorry for incomplete answer. You also need to implement tableView:canEditRowAtIndexPath: method (something like that):

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
    return indexPath.row > 0;
}

Hope that'll work

Vladimir
I tried the way u told but the when I swipe the first row the delete button is generating but the action is not performed.I am trying to not generate the delete button when I swipe the first row.can u please suggest me with more idea's?
monish
yup it's really works thanks vladimir!!
monish