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>?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 输入框的更多相关文章
- iOS TextField输入框点击键盘时随着键盘上移
-(void)textFieldDidBeginEditing:(UITextField *)textField { CGRect frame = textField.frame; int offse ...
- flutter TextField 输入框被软键盘挡住的解决方案
以前搞ionic1~4的开发中 和react-native flutter中的机制完全不同, 在flutter 中 当前页面如果存在元素被软键盘挡住 的情况 页面元素的最外层肯定得嵌套一层 S ...
- Jetpack Compose学习(3)——图标(Icon) 按钮(Button) 输入框(TextField) 的使用
原文地址: Jetpack Compose学习(3)--图标(Icon) 按钮(Button) 输入框(TextField) 的使用 | Stars-One的杂货小窝 本篇分别对常用的组件:图标(Ic ...
- Cocostudio学习笔记(4) LoadingBar+ TextField
这同时录制两个控件的使用方法:LoadingBar和 TextField. -------------------------------------------------------------- ...
- iOS数字键盘自定义按键
UIKeyboardTypeNumberPad 数字键盘自定义按键 最近做一个搜索用户的功能,这里使用了UISearchBar.由于搜索的方式只有手机号码,所以这里的键盘要限制为数字输入,可以这么做: ...
- iOS深入学习(Block全面分析)
本文翻译自苹果的文档,有删减,也有添加自己的理解部分. 如果有Block语法不懂的,可以参考fuckingblocksyntax,里面对于Block 为了方便对比,下面的代码我假设是写在ViewCon ...
- (转)Block的使用
转:http://my.oschina.net/leejan97/blog/268536 本文翻译自苹果的文档,有删减,也有添加自己的理解部分. 如果有Block语法不懂的,可以参考fuckingbl ...
- Block作为property属性实现页面之间传值(代替Delegate代理与协议结合的方法)
需求:在ViewController中,点击Button,push到下一个页面NextViewController,在NextViewController的输入框TextField中输入一串字符,返回 ...
- Black 全面分析
Black 全面分析 如果有Block语法不懂的,可以参考fuckingblocksyntax,里面对于Block 为了方便对比,下面的代码我假设是写在ViewController子类中的 1.第一部 ...
随机推荐
- OAF与Windows 7版本不兼容黑屏卡顿问题
OAF版本比较原始,在Window7中无法应用配色方案,导致黑屏卡顿问题.(在启动OC4J后,Window7的配色方案还是会还原至原始状态) 修改$JDEV_HOME/jdev/bin/jdev.co ...
- Android开发之全屏显示的两种方法
1.通过修改清单文件中Theme,实现全屏 <application android:name=".MyApplication" android:allowBackup=&q ...
- HTML5学习(九)----应用程序缓存
参考教程:http://www.w3school.com.cn/html5/html_5_app_cache.asp 使用 HTML5,通过创建 cache manifest 文件,可以轻松地创建 w ...
- JS 获取Button控件的提交类型
<script type="text/javascript"> <!--获取button控件的类型---> function isAuditOrCancel ...
- 【Grunt】
GRUNT The JavaScript Task Runnerhttp://gruntjs.com/ Grunt打造前端自动化工作流http://tgideas.qq.com/webplat/inf ...
- Java、JSP获得当前日期的年、月、日
Java package com.ob; import java.text.ParseException; import java.text.SimpleDateFormat; import java ...
- (转载)memcpy的几个实现版本
(转载)http://blog.sina.com.cn/s/blog_4d3a41f40100cvza.html 实现void *memcpy(void *to, const void *from, ...
- Ofbiz初探
转:http://xmmartin.blog.51cto.com/2310947/771236 主导建设一个电子商务系统希望从Ofbiz了解中获得一些借鉴1.下载ofbiz,目前的版本是10.04,下 ...
- IOS 多线程 NSOperation GCD
1.NSInvocationOperation NSInvocationOperation * op; NSOperationQueue * que = [[NSOperationQueuealloc ...
- 理解public,protected 以及 private
经常看到在类中看到public,protected,private以及它们在继承中表示的一些访问范围,很容易搞糊涂.我们首先要明白下面几点. 1.类的一个特征就是封装,public和private作用 ...