UIAlertController

UIAlertView iOS9.0之后注销了,简单介绍一下UIAlertController的使用:

 //提醒控制器类型有两种UIAlertControllerStyleActionSheet和UIAlertControllerStyleAlert
  UIAlertController *alertC=[UIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];  
 //
  UIAlertController *alert=[UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
   
 //
  UIAlertAction *cancel=[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
        
    }];

 //添加动作
    [alert addAction:cancel];
 //添加textfield
    [alert addTextFieldWithConfigurationHandler:^(UITextField *text){
        
    }];
 //展示提醒控制器
    [self presentViewController:alert animated:YES completion:nil];
原文地址:https://www.cnblogs.com/sunjianfei/p/5570853.html