我在基于消息的iPhone应用程序中工作。在我的应用程序中看起来像iMessage本机iOS应用程序。 I made Bubbles with used UIImageView and UILabel. I made UILabel as clickable and showing Copy option. It is working fine when the message input UITextView is not in active.
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在完全控制器中处于完全控制状态时。不来UILabel。你能帮我解决这个问题。
How to show UIMenuItem "Copy" when the user clicking UILabel if the keyboard is in visible the control is in UITextView?
你能否帮我解决这个问题。我在这个问题上花了两天时间。提前致谢。
答案 0 :(得分:0)
可能是我错了。请注意这个答案。
我试图像你想做的那样实现。那也不行。我发现我无法同时访问two views
。特别是当我有任何视图becomeFirstResponder
和you cannot access menu items of other view
时。
但如果您尝试这样做,您的代码可能会成功。
1)在touchesBegan:
方法中,找到触摸UILabel内部的用户。
2)如果发生这种情况,请使用类似copy,paste and select
之类的按钮显示自定义视图。