美文网首页
UIAlertController基本使用示例

UIAlertController基本使用示例

作者: AnderQZ | 来源:发表于2017-04-07 23:06 被阅读9次
    UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"My Alert"
                                                                   message:@"This is an alert."
                                                            preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Cancle" style:UIAlertActionStyleDefault handler:nil];
    
    UIAlertAction *cancleAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
        NSLog(@"do somting");
    }];
    
    [alert addAction:defaultAction];
    [alert addAction:cancleAction];
    [self presentViewController:alert animated:YES completion:nil];

    相关文章

      网友评论

          本文标题:UIAlertController基本使用示例

          本文链接:https://www.haomeiwen.com/subject/hqmkattx.html