UIAlertController

2018-03-20  本文已影响6人  安红唯CC

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"标题" message:@"message" preferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];

    [alertController addAction:cancelAction];

    UIAlertAction *OKAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

    }];

    [alertController addAction:OKAction];

    [self presentViewController:alertController animated:YES completion:nil];//在一般controller里面

[self.window.rootViewController presentViewController:alertController animated:YES completion:nil]; //在APPdelegate里面

上一篇下一篇

猜你喜欢

热点阅读