gpt4 book ai didi

ios - 在 UITableViewCell 内的 UITextView 上 resignfirstresponder

转载 作者:行者123 更新时间:2023-11-28 22:47:10 25 4
gpt4 key购买 nike

我希望有人能帮我解决一个 IOS/XCode 问题。

我需要在 UITableViewCell 中创建一个 UITextView,这个 UITextView 响应用户点击,然后将显示一个 UIPopoverController,以便显示一个子 UITableView(在 UIPopoverController 内),允许用户从选择列表(文本行)。在用户选择选项(文本行之一)后,该行文本将显示在所述 UITextView 中。我遇到的第一个问题是,当用户单击 UITextView 时,将显示键盘而不是 UIPopoverController。我该如何去禁用即。调用 resignFirstResponder,这样我就不会显示键盘,而是显示 UIPopoverController。有人愿意分享类似的代码吗?或者指出一些如何做到这一点的示例?非常感谢。

最佳答案

您可以使用以下委托(delegate)方法来检测何时点击 textView 并相应地显示您的 popOverController,在委托(delegate)方法中返回“NO”,这样就不会出现键盘......

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
// code to show popOverController

return NO;
}

关于ios - 在 UITableViewCell 内的 UITextView 上 resignfirstresponder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12927869/

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