zoukankan      html  css  js  c++  java
  • 提示框(UIAlertController)的使用。

      添加出现在屏幕中间的提示框(也就是之前的UIAlertView):

        UIAlertController * av = [UIAlertController alertControllerWithTitle:@"提示" message:@"请检查网络!" preferredStyle:(UIAlertControllerStyleAlert)];
        // 添加 取消 按钮
        [av addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
            NSLog(@"点击取消");
        }]];
        // 添加 确认 按钮
    
        [av addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            
            NSLog(@"点击确认");
            
        }]];
        // 添加 警告 按钮
    
        [av addAction:[UIAlertAction actionWithTitle:@"警告" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
            
            NSLog(@"点击警告");
            
        }]];
        // 添加 文本框 按钮
    
        [av addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
            
            NSLog(@"添加一个textField就会调用 这个block");
            
        }];
        
        //
        [self presentViewController:av animated:YES completion:nil];

    添加从底部弹出的提示框(也就是之前的UIActionSheet):

        UIAlertController * av = [UIAlertController alertControllerWithTitle:@"提示" message:@"请检查网络!" preferredStyle:(UIAlertControllerStyleActionSheet)];
    
        // 添加 取消 按钮
        [av addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
            NSLog(@"点击取消");
        }]];
        // 添加 确认 按钮
        
        [av addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            
            NSLog(@"点击确认");
            
        }]];
        // 添加 警告 按钮
        
        [av addAction:[UIAlertAction actionWithTitle:@"警告" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
            
            NSLog(@"点击警告");
            
        }]];
    
        
     
        [self presentViewController:av animated:YES completion:nil];
  • 相关阅读:
    SQLSERVER排查CPU占用高的情况
    bootstrap布局两列或者多列表单
    ASP.NET Redis 开发
    .NET 环境中使用RabbitMQ
    EasyNetQ介绍
    .Net使用RabbitMQ详解
    ASp.net中Froms验证方式
    全国-城市-百度地图中心点坐标
    IIS7.0下 HTTP 错误 404.15
    asp.net报错“尝试读取或写入受保护的内存。这通常指示其他内存已损坏”的解决办法
  • 原文地址:https://www.cnblogs.com/weipeng168/p/5220366.html
Copyright © 2011-2022 走看看