我通过设置标签用于骗取actionSheet = indexpath.row
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
// If row is deleted, remove it from the list.
if (editingStyle == UITableViewCellEditingStyleDelete)
{
UIActionSheet *registerActionSheet = [[UIActionSheet alloc] initWithTitle:@"Sure You Want To Delete?"delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:ACTION_SHEET_DELETE_BUTTON_TITLE otherButtonTitles: nil];
registerActionSheet.tag = indexPath.row;
registerActionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[registerActionSheet showInView:self.view];
}
}
然后
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if ([[actionSheet buttonTitleAtIndex:buttonIndex] isEqualToString:ACTION_SHEET_DELETE_BUTTON_TITLE]) {
//do deleting stuff here using actionSheet.tag as index
}
}
编辑:刚才看到微妙的多个部分你使用。通过向它添加indexPath属性来扩展UIActionSheet将有助于您的情况?
或将标记设置为'x'位数,前半部分表示部分,后半部分表示行。