UIAlertController

看一下如何实现下面的效果
UIAlertController_第1张图片

 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"操作提示" message:@"真的要注销吗?" preferredStyle:UIAlertControllerStyleActionSheet];

    UIAlertAction *tem1 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
        [self.navigationController popViewControllerAnimated:YES];
    }];

    UIAlertAction *tem2 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    [alert addAction:tem1];
    [alert addAction:tem2];

    [self.navigationController presentViewController:alert animated:YES completion:nil];

就这么easy

你可能感兴趣的:(UIAlertController)