- (IBAction)buttonPressed{
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Are you sure?" delegate:self cancelButtonTitle:@"No way" destructiveButtonTitle:@"Yes,I'm sure!" otherButtonTitles: nil];
[actionSheet showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
if (buttonIndex != [actionSheet cancelButtonIndex]) {
NSString *msg = nil;
if (nameField.text.length > 0)
msg = [[NSString alloc] initWithFormat:@"you can breathe easy, %@, everything want OK.", nameField.text];
else
msg = @"you can breathe easy, everything want OK.";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"something wan done" message:msg delegate:self cancelButtonTitle:@"Phew!" otherButtonTitles: nil];
[alert show];
}
IOS: Yes,No (对话框)
最新推荐文章于 2025-08-10 11:14:11 发布
本文探讨了在iOS应用中实现用户确认对话框的功能,并详细介绍了如何通过UIActionSheet展示确认提示,以及用户选择后的相应反馈操作。文章还涉及了在用户确认后执行特定操作并显示确认消息的实现细节。
61

被折叠的 条评论
为什么被折叠?



