在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];
}]];