警告框

作者: 赤焰军少帅林殊 | 来源:发表于2017-12-18 18:17 被阅读8次
     UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Title"  
                                                                       message:@"This is an alert."  
                                                                preferredStyle:UIAlertControllerStyleAlert];  
          
        UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault  
                                                              handler:^(UIAlertAction * action) {  
                                                                  //响应事件  
                                                                  NSLog(@"action = %@", action);  
                                                              }];  
        UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault  
                                                              handler:^(UIAlertAction * action) {  
                                                                  //响应事件  
                                                                  NSLog(@"action = %@", action);  
                                                              }];  
      
        [alert addAction:defaultAction];  
        [alert addAction:cancelAction];  
        [self presentViewController:alert animated:YES completion:nil];  
    
    

    相关文章

      网友评论

          本文标题:警告框

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