gpt4 book ai didi

ios - IOS 键盘按下

转载 作者:行者123 更新时间:2023-11-28 19:30:48 24 4
gpt4 key购买 nike

我有一些文本字段,当我点击它时它会显示键盘,但是当我点击页面上的任何地方时键盘不会消失。这是我的第一响应者辞职代码。我的代码有什么问题。

enter image description here

最佳答案

添加这段代码:

-(void)viewDidLoad
{
[super viewDidLoad];

UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapReceived:)];
[tapGestureRecognizer setDelegate:self];
[self.view addGestureRecognizer:tapGestureRecognizer];
}

-(void)tapReceived:(UITapGestureRecognizer *)tapGestureRecognizer
{
[textField resignFirstResponder];
}

关于ios - IOS 键盘按下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45011108/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com