xcode 删除确认
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4713715/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
deletion confirmation
提问by Pooja
I have one UIAction Sheet and there are 4 buttons, 1 is delete. delete is running perfectly but now i want to add some confirmation box, so if user click on "Yes" button the record will be delete else not. I don't know how to add this confirmation box and where?
我有一个 UIAction 表,有 4 个按钮,1 个是删除。删除运行完美,但现在我想添加一些确认框,所以如果用户点击“是”按钮,记录将被删除,否则不会。我不知道如何添加这个确认框以及在哪里?
thank you in advance.
先感谢您。
回答by Sudhanshu
@pooja i suggest u to use UIAlertView
for that in your code where you are using UIActionSheet
delete button on delete button action call this..
@pooja 我建议你UIAlertView
在你的代码中使用它,你UIActionSheet
在删除按钮操作上使用删除按钮调用这个..
UIAlertView *updateAlert = [[UIAlertView alloc] initWithTitle: @"Item Deletion" message: @"Do u really want to delete" delegate: self cancelButtonTitle: @"YES" otherButtonTitles:@"NO",nil];
[updateAlert show];
[updateAlert release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex==0)
{
//give deletion code here
}
}
and do forgot to call UIActionSheetDelegate
...
Hope this will help u!!!!
忘记打电话了UIActionSheetDelegate
......希望这会帮助你!!!!
回答by Aditya
You need to put an alert view for this purpose.When the button at index 0,1 is pressed perform the desired action.You will have to put this alert view when the user presses the delete button of the Action Sheet.
为此,您需要放置一个警报视图。当按下索引 0,1 处的按钮时,执行所需的操作。当用户按下操作表的删除按钮时,您必须放置此警报视图。
Cheers
干杯