cuốn sách gpt4 ai đã làm

ios - 键盘消除问题 - Objective C

In lại Tác giả: Walker 123 更新时间:2023-11-29 05:01:39 25 4
mua khóa gpt4 Nike

我已将文本字段的委托(delegate)设置为 self,并在 .h 中添加了它的委托(delegate),但我遇到了问题。如果我单击 View 中除文本字段之外的任何内容,我希望键盘隐藏。这可能吗?如果是这样,我该怎么做?

câu trả lời hay nhất

我找到了一种更简单的隐藏键盘的方法,当您单击屏幕方式时它就可以工作。

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
// endEditing: This method looks at the current view and its subview hierarchy for the text field that is currently the first responder.
// If it finds one, it asks that text field to resign as first responder
[[self view] endEditing:TRUE];
}

关于ios - 键盘消除问题 - Objective C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6796287/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress