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

 

posted @ 2016-06-08 17:47  有棱角的圆  阅读(193)  评论(0编辑  收藏  举报