您的位置:首页 > 产品设计 > UI/UE

使用UIActionSheet警告用户是否确定执行操作

2012-07-01 19:07 127 查看
当用户操作具有一定危险性时,可以使用UIActionSheet来警告用户是否继续执行相关操作,比如删除某个文件时,最开始我用UIAlertView弹出窗体来提示用户,以为当[(UIAlertView*) alert show]时程序会等待用户点击按钮处理之后再继续向下执行,但是IOS并不像C#中winform下编程那样,后来就改换了UIActionSheet来执行,如下:
先在.h文件中添加协议
@interface ActionSheetUITableViewController :
UITableViewController<UIActionSheetDelegate>
UIActionSheet *actionSheet = [[UIActionSheet
alloc]

initWithTitle:@""

delegate:self

cancelButtonTitle:@"取消"

destructiveButtonTitle:@"确定"

otherButtonTitles:nil];
[actionSheet
showInView:self.view];

- (void)actionSheet:(UIActionSheet *)actionSheet
didDismissWithButtonIndex:(NSInteger)buttonIndex {
//等待用户再次确认之后相关的操作代码
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐