ios 关闭键盘的常见方法
2014-04-25 18:05
232 查看
首先.h中声明关闭虚拟键盘方法-(IBAction)closeKeyBoard:(id)sender;
.m中实现:
方法一:拖一个Button到view中,并将它铺满整屏,设置按钮样式为Custom,即无外观。连接button的touch up inside方法即可。
-(void)closeKeyBoard:(id)sender
{
[textFieldName resignFirstResponder];
}
方法二:在主view的identity inspector中将custom class改为UIcontrol,这样就能够触发操作方法。实现方法同一,然后连接view的touch up inside方法即可。
方法三:当textfield很多时,使用此方法可以不用一个个遍历输入框。
-(void)closeKeyBoard:(id)sender
{
[self.view endEditing:YES];
}
.m中实现:
方法一:拖一个Button到view中,并将它铺满整屏,设置按钮样式为Custom,即无外观。连接button的touch up inside方法即可。
-(void)closeKeyBoard:(id)sender
{
[textFieldName resignFirstResponder];
}
方法二:在主view的identity inspector中将custom class改为UIcontrol,这样就能够触发操作方法。实现方法同一,然后连接view的touch up inside方法即可。
方法三:当textfield很多时,使用此方法可以不用一个个遍历输入框。
-(void)closeKeyBoard:(id)sender
{
[self.view endEditing:YES];
}
相关文章推荐
- 【读书笔记】iOS-关闭键盘的2种方法
- iOS关闭键盘的两种简单方法
- 【读书笔记】iOS-关闭键盘的2种方法
- iOS关闭键盘的方法
- iOS 隐藏键盘的几种常见方法
- 【转】iOS开发-关闭/收起键盘方法总结
- iOS 中关闭键盘方法
- iOS关闭键盘的几种方法
- IOS开发-关闭/收起键盘方法总结
- iOS开发-关闭/收起键盘方法总结
- iOS关闭键盘的方法
- IOS学习笔记 ­­­­­­— UITextField 输入完毕关闭键盘方法
- 整理所有IOS开发关闭键盘方法
- iOS UITextField完成输入后关闭键盘的方法总结
- IOS中关闭键盘的方法
- iOS关闭键盘的两种简单方法
- IOS 点击屏幕空白部分关闭键盘方法
- iOS开发-关闭/收起键盘方法总结
- IOS开发-关闭/收起键盘方法总结
- IOS关闭键盘的方法