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>?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]; }

UIAlertViewController+TextField 输入框的更多相关文章

  1. iOS TextField输入框点击键盘时随着键盘上移

    -(void)textFieldDidBeginEditing:(UITextField *)textField { CGRect frame = textField.frame; int offse ...

  2. flutter TextField 输入框被软键盘挡住的解决方案

    以前搞ionic1~4的开发中 和react-native   flutter中的机制完全不同, 在flutter 中 当前页面如果存在元素被软键盘挡住 的情况 页面元素的最外层肯定得嵌套一层   S ...

  3. Jetpack Compose学习(3)——图标(Icon) 按钮(Button) 输入框(TextField) 的使用

    原文地址: Jetpack Compose学习(3)--图标(Icon) 按钮(Button) 输入框(TextField) 的使用 | Stars-One的杂货小窝 本篇分别对常用的组件:图标(Ic ...

  4. Cocostudio学习笔记(4) LoadingBar+ TextField

    这同时录制两个控件的使用方法:LoadingBar和 TextField. -------------------------------------------------------------- ...

  5. iOS数字键盘自定义按键

    UIKeyboardTypeNumberPad 数字键盘自定义按键 最近做一个搜索用户的功能,这里使用了UISearchBar.由于搜索的方式只有手机号码,所以这里的键盘要限制为数字输入,可以这么做: ...

  6. iOS深入学习(Block全面分析)

    本文翻译自苹果的文档,有删减,也有添加自己的理解部分. 如果有Block语法不懂的,可以参考fuckingblocksyntax,里面对于Block 为了方便对比,下面的代码我假设是写在ViewCon ...

  7. (转)Block的使用

    转:http://my.oschina.net/leejan97/blog/268536 本文翻译自苹果的文档,有删减,也有添加自己的理解部分. 如果有Block语法不懂的,可以参考fuckingbl ...

  8. Block作为property属性实现页面之间传值(代替Delegate代理与协议结合的方法)

    需求:在ViewController中,点击Button,push到下一个页面NextViewController,在NextViewController的输入框TextField中输入一串字符,返回 ...

  9. Black 全面分析

    Black 全面分析 如果有Block语法不懂的,可以参考fuckingblocksyntax,里面对于Block 为了方便对比,下面的代码我假设是写在ViewController子类中的 1.第一部 ...

随机推荐

  1. eclipse myeclipse zend studio 中去掉双引号中的斜体

    去windows/preferences 菜单里,选Web/JSP Files/Editor/Syntax Coloring 在右边选Attribute Values ,把Italic的钩去掉就好了.

  2. 驱动之路-platform简例按键驱动☆☆☆

    一 .重要知识点: ▉1.platform设备模型 从Linux 2.6起引入了一套新的驱动管理和注册机制,platform_device和platform_driver,Linux中大部分的设备驱动 ...

  3. C语言计算程序运行时间

    #include<stdio.h>#include<stdlib.h> #include "time.h" int main( void )  {     ...

  4. [scu 4423] Necklace

    4423: Necklace Description baihacker bought a necklace for his wife on their wedding anniversary. A ...

  5. Java框架的思考

    目前的JAVA 企业级开发框架,我们常用的大致包括IOC AOP MVC ORM框架 1. IOC spring是一个非常棒的ico容器,其思想非常简单,用一个集合对象如MAP 来缓存对象(对象都是单 ...

  6. git参考书籍

    Pro GIt 简体中文版 http://iissnan.com/progit/

  7. 用VisualSVN做项目版本控制

    一.SVN服务端 1.VisualSVN Server下载: http://download.csdn.net/detail/jiminull/4448874 或 http://www.visuals ...

  8. HDU 3533 Escape BFS搜索

    题意:懒得说了 分析:开个no[100][100][1000]的bool类型的数组就行了,没啥可说的 #include <iostream> #include <cstdio> ...

  9. js模拟键盘按键事件

    var WshShell = new ActiveXObject('WScript.Shell') WshShell.SendKeys('{ }'); 说明:大括号内的是键盘上的按键如: 空格:{ } ...

  10. bzoj 3198 [Sdoi2013]spring(容斥原理+Hash)

    Description Input Output Sample Input 3 3 1 2 3 4 5 6 1 2 3 0 0 0 0 0 0 4 5 6 Sample Output 2 HINT [ ...