在iOS9.0以后,UIAlertView已经被弃用。下面介绍一下UIAlertController
UIAlertController*alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"登录失败,用户名或者密码错误!" preferredStyle: UIAlertControllerStyleAlert];
//设置字体颜色
alert.view.tintColor=[UIColor redColor];
//确定
[alert addAction:[UIAlertActionactionWithTitle:@"确定" style:UIAlertActionStyleDefaulthandler:^(UIAlertAction * _Nonnull action) {
}]];
//弹出提示框;
[self presentViewController:alert animated:true completion:nil];
}]];
本文介绍在iOS9.0之后UIAlertView被弃用后如何使用UIAlertController来替代。通过具体代码示例展示了UIAlertController的基本用法,包括创建UIAlertController、设置样式、添加按钮及显示提示框的过程。
1022

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



