UITextField 详细解释
来源:互联网 发布:数据库存储多个坐标 编辑:程序博客网 时间:2024/05/01 01:19
self.textFuserName.placeholder = @"请输入用户名"; //输入框中是否有个叉号 self.textFuserName.clearButtonMode = UITextFieldViewModeAlways; //再次编辑就清空 self.textFuserName.clearsOnBeginEditing = YES; //设置键盘的样式 self.textFuserName.keyboardType = UIKeyboardTypeASCIICapable; //return键变成什么键 self.textFuserName.returnKeyType = UIReturnKeyNext; //键盘外观 self.textFuserName.keyboardAppearance = UIKeyboardAppearanceDark; //自动弹出键盘 [self.textFuserName becomeFirstResponder]; self.textFuserName.delegate = self;
常用代理方法:
//多个UITextField 点击“Return”,执行事件- (BOOL)textFieldShouldReturn:(UITextField *)textField{ //主要是[receiver resignFirstResponder]在哪调用就能把receiver对应的键盘往下收 if (textField == self.textFuserName) { [self.textFpassword becomeFirstResponder]; } if (textField == self.textFpassword) { [self.textFpassword2 becomeFirstResponder]; } if (textField == self.textFpassword2) { [self.textFniChen becomeFirstResponder]; } if (textField == self.textFniChen) { [textField resignFirstResponder]; [self clickedPushNextzhuce:self.btnPush]; } return YES;}
//当前编辑框,编辑完成,获取所输入的内容- (BOOL)textFieldShouldEndEditing:(UITextField *)textField{ //返回BOOL值,指定是否允许文本字段结束编辑,当编辑结束,文本字段会让出first responder //要想在用户结束编辑时阻止文本字段消失,可以返回NO //这对一些文本字段必须始终保持活跃状态的程序很有用,比如即时消息 if (textField == self.textFuserName) { strUsername = textField.text; [self panduanString:strUsername]; } if (textField == self.textFpassword) { } if (textField == self.textFpassword2) { } if (textField == self.textFniChen) { } return YES;}
#pragma mark 点击空白处,键盘弹下去/*只能通过Return关闭软键盘太不灵活了,应该提供轻触背景隐藏软键盘的功能。在storyboard,点击背景View,将它的Custom Class设置为UIControl,这样才会出现Touch Down事件。右击背景View弹出面板,按住Touch Down事件旁边的圆圈,然后拖曳到右侧.h文件的空白地方建立该事件的处理方法。*/- (IBAction)view_TouchDown:(id)sender{ // 发送resignFirstResponder. [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];}
0 0
- UITextField 详细解释
- 《 Swift ---->>UITextField 控件的学习和方法的详细解释《包含代理》》
- UITextField的详细使用
- UITextField的详细使用
- UITextField的详细使用
- UITextField的详细使
- IOS UITextField详细说明
- iOS uitextfield详细使用说明
- UITextField的详细介绍
- iOS - UITextField 详细使用方法
- UITextField详细应用
- UITextField 的详细使用
- UITextField的详细使用
- UITextField 详细介绍 别人的
- UILable和UITextField的详细讲解
- UILable和UITextField的详细讲解
- UILabel和UITextField的详细讲解
- UILable和UITextField的详细讲解
- Tomcat服务器常用配置(一)
- python 中的 __new__ 和 __init__
- [centos5.4 x86 64位]使用第三方软件仓库|使用RPMForge软件库
- Oracle 多个连接池
- Java RTTI and Reflection
- UITextField 详细解释
- AVFoundation
- UVA 208 - Firetruck DFS 并查集剪枝
- openjudge 高速公路(非prim算法)
- STL迭代器失效
- Permission denied (publickey). fatal: The remote end hung up unexpectedly while pushing back to git
- Android 采用fastboot刷system.img boot.img recovery.img
- 谷歌眼镜晋级:电池续航提高/移除视频通话
- 搭建GCM项目——服务端和客户端(二)