在ios开发当中,当遇到删除数据或者错误时,需要弹出一个对话框,用于提醒用户,当前遇到了问题,那么对于这种实现方法来说,可以有如下两种不同的表现方式,一种是ACTION SHEET,另一种是ALERT VIEW.
ACTION SHEET,是在屏幕的下方出现一个对话框,该对话框当中可以包含几个按钮。
ALERT VIEW,则完全不同,他会在屏幕的中间弹出,并且包含提示信息。
1、ACTION SHEET
实现一个协议委托<UIActionSheetDelegate>
UIActionSheet * sheet = 【UIActionSheet alloc】 initWithTitle:@"清空用户名和密码"
delegate:self
cancelButtonTitle:@"取消"
destrutiveButtontitle:@“清空"
otherButtontitles:nil】
【sheet showInView:self。view】
委托方法:actionsheet: didDismissWithButtonIndex:
2、ALERT VIEW
UIAlertView * view = [UIAlertView alloc] initwithtitle:@”清空操作"
message:@“清空用户名和密码”
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil]
[view show]
本文介绍了iOS开发中两种警告框的使用方法:ACTIONSHEET和ALERTVIEW。ACTIONSHEET从屏幕底部弹出并可包含多个按钮;ALERTVIEW则居中显示并提供提示信息。
622

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



