UIAlertController

  • 在iOS 8.3以后苹果不建议使用UIActionSheet创建弹框

  • 用UIAlertController

//  创建弹框控制器
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"isEdit" message:nil preferredStyle:UIAlertControllerStyleAlert];

    // 添加弹框信息:YES
     // UIAlertActionStyleDestructive : 毁灭性的
    [alertController addAction:[UIAlertAction actionWithTitle:@"YES" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {


    }]];

    // 添加弹框信息:NO
    [alertController addAction:[UIAlertAction actionWithTitle:@"NO" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

    }]];

    // 显示弹框控制器
    [self presentViewController:alertController animated:YES completion:nil];

results matching ""

    No results matching ""