开发者

iPhone toggleEdit - disable delete?

When I execute toggleEdit, a red button with a white line in the middle shows up on the left (to enable delete) and a blue button with a white arrow shows up on the right of each cell in my UITable:

 -(IBAction)toggleEdit:(id)sender {
     [self.table setEditing:!self.table.editing animated:YES];
 }

The blue button on the right shows up because for each cell I have:

 cell.editingAccessoryType = UITableViewCellAccessoryDetailDis开发者_JS百科closureButton;

Is it possible when executing toggleEdit to not show the red button on the left?


Yes. In your:

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

just return anything other than UITableViewCellEditingStyleDelete for items that are can't be deleted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜