zoukankan      html  css  js  c++  java
  • 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];

    }

     
     
     
  • 相关阅读:
    [Leetcode] Median of Two Sorted Arrays
    [Jobdu] 题目1463:招聘会
    [Leetcode] Merge Two Sorted Lists
    [Leetcode] Combinations
    [Leetcode] Populating Next Right Pointers in Each Node II
    [Leetcode] Insertion Sort List
    redis在Web中的使用
    设计模式:单例模式
    设计模式:基本法则
    设计模式:工厂模式
  • 原文地址:https://www.cnblogs.com/careerman/p/11870679.html
Copyright © 2011-2022 走看看