ios - Disable UITableViewCellEditingStyleDelete for certain cell -
i have tableview , want display uitableviewcelleditingstyledelete
not of them. based on condition, cell's want show popover
without delete button style.
in current implementation, when swipe delete still able see both uitableviewcelleditingstyledelete
, popover
.
i wonder how able achieve see popover
when user swipe right left without uitableviewcelleditingstyledelete
?
self.tableview.allowsmultipleselectionduringediting = no; -(void)tableview:(uitableview *)tableview willbegineditingrowatindexpath:(nsindexpath *)indexpath { if([globalfunctions iscomboitem:itemid]) { // show popover --> done // hide uitableviewcelleditingstyledelete --> ?? dont know } } - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { nsstring *itemid = [(nsdictionary *)[shareddata.orderitems objectatindex:indexpath.row] objectforkey:kitemid]; [globalfunctions deleteitemfromorder:itemid]; [self calculate]; } }
if (indexpath.row > 5 ) { // editing not allowed greater 5 } else { // 5,4,3,2,1 editing allowed }
try
Comments
Post a Comment