UIAlertController

 

 
  

专题 UIAlertController

  

// iOS8之前

    // UIAlertView

    // UIActionSheet;

    

    // iOS8开始

    // UIAlertController == UIAlertView + UIActionSheet

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];

    

    // 添加按钮

    [alert addAction:[UIAlertAction actionWithTitle:@"收藏" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

        XMGLog(@"点击了[收藏]");

    }]];

    [alert addAction:[UIAlertAction actionWithTitle:@"举报" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

        XMGLog(@"点击了[举报]");

    }]];

    [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {

        XMGLog(@"点击了[取消]");

    }]];

    

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

 

 

   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
posted @ 2015-10-28 16:34  吃饭了吗  阅读(144)  评论(0编辑  收藏  举报