您的位置:首页 > 其它

如何实现用户触摸屏幕就隐藏弹出的键盘功能

2011-05-22 10:24 387 查看
                                             如何实现用户触摸屏幕就隐藏弹出的键盘功能

 

1.    主要是响应  UIResponder 类的

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;

 

或者

 

 

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

 

 

因为我们的controller一般从  UIViewController 继承,而 UIViewController  从UIResponder继承,所以 Controller 可以直接使用这两个

函数。

 

 

 

下面是代码:

//当用户触摸的时候,隐藏键盘
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[content_ resignFirstResponder];

[super touchesBegan:touches withEvent:event];
}
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐