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");
}
}