gpt4 book ai didi

iphone - UIMenuController 未显示 UIPasteBoard 已清除 iPhone 应用程序?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:44:11 32 4
gpt4 key购买 nike

我在基于消息的 iPhone 应用程序中工作。在我的应用程序中看起来像 iMessage native iOS 应用程序。 我用用过的 UIImageView 和 UILabel 制作了气泡。我将 UILabel 设为可点击并显示复制选项。当消息输入 UITextView 未处于事件状态时,它工作正常。

1. I can show the "Copy" option when we clicking UILabel and the UITextView is not becomeFirstResponder.

2. When the user clicking the MessageTextView (UITextView) from the bottom of the screen the UITextView becoming first responder and keyboard is showing now. In this scenario if the user clicking the messabe bubble (UILabel) the UIMenuItem showing "Paste" on the bubble instead of "Copy".

3. If i click "Paste" from the bubble UIMenuItem already copied text will be pasting in UITextView. So the control fully in UITextView UIMenuController not activated in UILabel. So i cleared the text from UIPateBoard when the user clicking the Bubble (UILabel).

4. Now the UIMenuController not showing up even [self becomeFirstResponder]; not becoming in UILabel class.

原因是当 UITextView 在 becomeFirstResponder 中时,控件完全处于那个状态。不来 UILabel。你能帮我解决这个问题吗?

如果键盘可见且控件在 UITextView 中,当用户单击 UILabel 时如何显示 UIMenuItem“复制”?请您帮我解决这个问题。我在这个问题上花了两天时间。提前致谢。

enter image description here

最佳答案

可能是我错了。请将此回答视为评论。

我尝试实现您正在尝试做的事情。那也行不通。我发现我无法同时访问两个 View 。特别是当我有任何 View becomeFirstResponder您无法访问其他 View 的菜单项 时。

但是如果你这样尝试,你的代码可能会成功。

1) 在 touchesBegan: 方法中,找到在您的 UILabel 内部触摸的用户。

2) 如果发生这种情况,则显示一个带有按钮的自定义 View ,例如 copy,paste and select 之类的。

关于iphone - UIMenuController 未显示 UIPasteBoard 已清除 iPhone 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13006467/

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