1. UIAlertView
*alert = [[UIAlertView
alloc]
initWithTitle:@"提示"
message:@"这是个提示"delegate:self
cancelButtonTitle:@"取消"
otherButtonTitles:@"确定",
nil];
[alert show];
2. 它的代理:
//点取消会打印00,点确定会打印11;
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSLog(@"00");
} else if (buttonIndex == 1) {
NSLog(@"11");
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSLog(@"00");
} else if (buttonIndex == 1) {
NSLog(@"11");
}
}
本文介绍如何使用UIAlertView显示提示消息,并通过代理方法处理用户的按钮点击事件。示例代码展示了UIAlertView的基本配置,包括设置标题、消息、按钮标题等。
146

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



