ios6下隐藏文本框输入键盘

1.对于textfield不是数字键盘的,可以关联事件Did End on Exit事件到
- (IBAction)hideKeyboard:(id)sender

2.如果是textview 或者数字键盘没有Did End on Exit事件的,我们可以增加一个button
type选择customer, Drawing选择Opaque且去除default title, 然后选择该按钮并把该按钮
拖放到View Controller的图标上面, 放开手时选择方法
- (IBAction)hideKeyboard:(id)sender

然后如图设置该按钮为背景
ios6下隐藏文本框输入键盘
‘选择按钮,从菜单的Editor->Arrange->send to Back’

3.在方法hideKeyboard里面加入
[textfield resignFirstResponder]
textview resignFirstResponder]

你可能感兴趣的:(UI,iPhone,ipad,iOS6,隐藏键盘)