3

我在基于消息的 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 处于 becomeFirstResponder 中时,控件完全在其中。不来 UILabel。你能帮我解决这个问题吗?

How to show UIMenuItem "Copy" when the user clicking UILabel if the keyboard is in visible the control is in UITextView?你能帮我解决这个问题吗?我在这个问题上花了两天时间。提前致谢。

在此处输入图像描述

4

1 回答 1

0

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

我试图达到你想要做的事情。那也不行。我发现我无法同时访问two views。尤其是当我有任何看法becomeFirstResponderyou cannot access menu items of other view.

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

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

2)如果发生这种情况,则显示带有类似按钮的自定义视图copy,paste and select

于 2012-10-22T09:44:58.083 回答