ViewController.m文件添加代码
- (IBAction)displayAlertBtn:(id)sender
{
UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"aa" message:@"bb" delegate:self cancelButtonTitle:@"dd" otherButtonTitles:@"cc",@"qq", nil];
[alert1 show];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if(0 == buttonIndex)
{
UIAlertView *alert2 = [[UIAlertView alloc] initWithTitle:@"gg" message:@"gg" delegate:nil cancelButtonTitle:@"gg" otherButtonTitles:nil, nil];
[alert2 show];
}
else if(1 == buttonIndex)
{
UIAlertView *alert3 = [[UIAlertView alloc] initWithTitle:@"kk" message:@"kk" delegate:nil cancelButtonTitle:@"kk" otherButtonTitles:nil, nil];
[alert3 show];
}
}
实现显示AlertView 并可以响应AlertView按钮