基本属性
1.initWithTitle:设置标题
2.delegate:设置Alert的委托, 设成self
//提醒视图(UIAlerView的创建)
//1.创建
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"标题" message:@"信息" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定",@"其他信息", nil];
//2.显示
[alertView show];
[alertView release];
//alertView的协议方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//默认的取消按钮 buttonIndex为0
//其他按钮依次为1 2 3 。。。
NSLog(@"%ld", (long)buttonIndex);
if (1 == buttonIndex) {
NSLog(@"确定");
}
}