UIAlertView 提示框
定义并显示:
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"title" message:nil delegate:nil cancelButtonTitle:@"button" otherButtonTitles: @"otherButton",nil]; [alert show]; [alert release];
多个按钮可对otherButtonTitles进行设置 例如:otherButtonTitles: @"otherButtonOne",@"otherButtonTwo",nil
当多个按钮是判断按下了哪个按钮,首先要遵守 UIAlertViewDelegate 协议
重写方法:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0){
NSLog(@"The First Button Pressed");
}else if(buttonIndex == 1){
NSLog(@"The Second Button Pressed");
}else{
.....
}
判断buttonIndex的值即可。
本文详细介绍了如何定义和显示UIAlertView提示框,包括多个按钮的设置与响应机制,为iOS开发者提供实用指南。
2969

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



