解决方法是
if (IOS7 > 8.0) {
UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:msg message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
}];
[alertCtrl addAction:okAction];
[[[[[UIApplication sharedApplication] windows] objectAtIndex:0] rootViewController] presentViewController:alertCtrl animated:YES completion:^{
}];
}
else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:msg
delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alert show];
[alert release];
}
本文详细介绍了如何在iOS7及以上版本中实现UIAlertController和UIAlertView两种类型的弹窗提示,包括创建对话框、添加操作按钮以及展示提示框的具体步骤。

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



