ios中怎么设置textfield点击其他地方键盘收回
答案:2 悬赏:80 手机版
解决时间 2021-04-05 00:46
- 提问者网友:棒棒糖
- 2021-04-04 11:08
ios中怎么设置textfield点击其他地方键盘收回
最佳答案
- 五星知识达人网友:愁杀梦里人
- 2021-04-04 11:47
//在点击需要收回键盘的视图添加单击手势
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(reKeyBoard)];
[self.view addGestureRecognizer:tap];
//实现方法//取消textView ,textField的第一响应者即可
- (void)reKeyBoard
{
[_introduceGroupField resignFirstResponder];
[_nameGroupField resignFirstResponder];
}
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(reKeyBoard)];
[self.view addGestureRecognizer:tap];
//实现方法//取消textView ,textField的第一响应者即可
- (void)reKeyBoard
{
[_introduceGroupField resignFirstResponder];
[_nameGroupField resignFirstResponder];
}
全部回答
- 1楼网友:末日狂欢
- 2021-04-04 13:09
//在点击需要收回键盘的视图添加单击手势
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(reKeyBoard)];
[self.view addGestureRecognizer:tap];
//实现方法//取消textView ,textField的第一响应者即可
- (void)reKeyBoard
{
[_introduceGroupField resignFirstResponder];
[_nameGroupField resignFirstResponder];
}
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(reKeyBoard)];
[self.view addGestureRecognizer:tap];
//实现方法//取消textView ,textField的第一响应者即可
- (void)reKeyBoard
{
[_introduceGroupField resignFirstResponder];
[_nameGroupField resignFirstResponder];
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯