您的位置:首页 > 其它

iphone:点击背景隐藏键盘

2012-05-04 21:10 239 查看
修改视图控制器的view属性,将它的底层类由UIView更改为UIControl

添加一个Action,Action是Touch Down

- (IBAction)backgroudTap:(id)sender {

[myTextField resignFirstResponder];

}

记住你的UITextField的Outlet一定要是weak的属性(一般的Outlet都是weak的),不然会出错

-[UITextInputTraits resignFirstResponder]: unrecognized selector sent to instance
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: