• iOS 自己写的对话框中加入三个输入框


    -(void)dialog:(NSString*)title okTitle:(NSString*)okTitle placeholder:(NSString*)placeholder finish:(UIAlertControllerSuccess)finish {

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

        UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:okTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

    //        UITextField* edictTextField = alert.textFields[0];

    //        DLOG(@"点击了ok %@", edictTextField.text);

            finish(1, alert.textFields);

        }];

        

        UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

            [alert dismissViewControllerAnimated:YES completion:nil];

            finish(0, alert.textFields);

    //        UITextField* edictTextField = alert.textFields[0];

    //        DLOG(@"点击了cancel %@", edictTextField.text);

        }];

        

        [alert addAction:defaultAction];

        [alert addAction:cancel];

        [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {

            textField.placeholder = @"输入1";

        }];

        [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {

            textField.placeholder = @"输入2";

        }];

        [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {

            textField.placeholder = @"输入3";

        }];

        

        [self presentViewController:alert animated:YES completion:nil];

    }

     
     
     
  • 相关阅读:
    Webpack 学习2
    Webpack 学习
    JS魔法堂:彻底理解0.1 + 0.2 === 0.30000000000000004的背后
    JS魔法堂:再识Number type
    基础野:细说浮点数
    基础野:细说有符号整数
    基础野:细说无符号整数
    基础野:细说原码、反码和补码
    Vim魔法堂:认识快捷键绑定
    Httpd运维日志:通过apxs添加模块
  • 原文地址:https://www.cnblogs.com/careerman/p/11870679.html
Copyright © 2020-2023  润新知