iOS 在NSObject的子类中使用UIAlertController

来源:互联网 发布:台湾的军事实力 知乎 编辑:程序博客网 时间:2024/05/18 02:09
UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"温馨提示"  message:@"打开" preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    [alert addAction:cancelAction];
    
    UIViewController * rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
    [rootViewController presentViewController:alert animated:YES completion:^{
        
    }];
0 0
原创粉丝点击