zoukankan      html  css  js  c++  java
  • UIAlertViewController+TextField 输入框

        if (IOS8) {
            UIAlertController *alertController=[UIAlertController alertControllerWithTitle:CustomLocalizedString(@"SetIp", nil) message:@"" preferredStyle:UIAlertControllerStyleAlert];
            [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
                NSString *string=[[NSUserDefaults standardUserDefaults]stringForKey:KSETIP];
                [textField setText:string.length>0?string:@""];
               
            }];
            UIAlertAction *action=[UIAlertAction actionWithTitle:CustomLocalizedString(@"OK", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
                str_ip=[alertController.textFields firstObject].text;
                 NSLog(@"设置的Ip=%@",str_ip);
                [[NSUserDefaults standardUserDefaults]setObject:str_ip forKey:KSETIP];
                [[NSUserDefaults standardUserDefaults]synchronize];
            }];
            UIAlertAction *action_cancel=[UIAlertAction actionWithTitle:CustomLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                [self dismissViewControllerAnimated:YES completion:nil];
            }];
            [alertController addAction:action];
            [alertController addAction:action_cancel];
            [self presentViewController:alertController animated:YES completion:nil];
           
        }

  • 相关阅读:
    学习笔记之05-printf和scanf函数
    学习笔记之04-函数
    学习笔记之03-第一个C程序代码分析
    学习笔记之02-第一个C程序
    学习笔记之01-C语言概述
    Internal Server Error with LAMP
    Git学习总结
    Git-多人协作
    素数之和
    数列之和
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/5044867.html
Copyright © 2011-2022 走看看