1 UIAlertView 类似于Android中的Dialog,简单用法如下:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Messate" delegate:nil cancelButtonTitle:@"Cancle" otherButtonTitles:nil, nil];
[alertView show];
2 UIActionSheet底部弹出的对话框,较常用,简单用法如下:
UIActionSheet *actionSheet = [[UIActionSheetalloc] initWithTitle:@"您确定要清除文本框内的内容吗?" delegate:selfcancelButtonTitle:@"取消"destructiveButtonTitle:@"确定"otherButtonTitles:nil];
[actionSheet showInView:self.view];
总结:两者都有Delegate,并Delegate中的方法,实现对事件的监听。
IOS学习第二课 UIAlertView和UIActionSheet
时间: 2024-12-25 19:23:41