imvkmark
11/30/2018 - 3:40 AM

oc:alert

Alert 弹出框

 // 这个是 9.0 之前代码
 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hellp"
                                            message:@"hello"
                                           delegate:nil
                                  cancelButtonTitle:@"Close"
                                  otherButtonTitles:nil];
 [alert show];
 
 // 这个是 9.0 之后的代码
 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Title"
                                                               message:@"Message"
                                                        preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"OK"
                                                       style:UIAlertActionStyleDefault
                                                     handler:^(UIAlertAction * action){ }
                              ];
[alert addAction:defaultAction];
[self presentViewController:alert animated:YES completion:nil];