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];
  • 相关阅读:
    PDO如何选择其他数据库的驱动
    PHP里关于时间日期大小写(Y,y,M,m...)
    数据库的基本操作
    数据库--PHP环境搭建
    曾经的中国互联网:多少巨头销声匿迹
    SQL 查找 45道练习题
    关于padding
    Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)
    centos 格式化硬盘并挂载,添加重启后生效
    windows2003服务器不显示桌面怎么办
  • 原文地址:https://www.cnblogs.com/weipeng168/p/5220366.html
Copyright © 2011-2022 走看看