【问题标题】:UIMenuController not showing UIPasteBoard is cleared iPhone app?UIMenuController 未显示 UIPasteBoard 已清除 iPhone 应用程序?
【发布时间】:2012-10-22 07:07:48
【问题描述】:

我正在使用基于消息的 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?你能帮我解决这个问题吗?我在这个问题上花了两天时间。提前致谢。

【问题讨论】:

  • 请说明你的视图层次结构..你能放一些截图吗??
  • 是的,伙计。我会编辑我的问题。谢谢。
  • 好吧..希望一些图片能清楚你的问题
  • @R.A 我编辑了我的问题。如果您需要更多信息,请查看并告诉我。谢谢。寻找您的答案。

标签: iphone ios uilabel uitextview uimenucontroller


【解决方案1】:

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

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

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

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

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

【讨论】:

  • 但是如何才能在气泡上正确显示自定义视图?我的计算能力很弱。所以我只是想这样做哈哈..
  • 你不需要计算任何东西。您只需要该标签的插座..获取用户触摸视图的位置并在该位置添加您的自定义视图。使用 locationInView: 方法让用户触摸位置
  • 你在聊天室吗?你能告诉我你聊天室的名字吗?在这个问题上我需要你的帮助。谢谢。
  • 不,我也在工作。。按我说的尝试。如果你有任何问题,我会在这里回复你。
  • 是的朋友.. 非常感谢你.. 如果我有任何问题,我会告诉你的。 :)
猜你喜欢
  • 1970-01-01
  • 2019-04-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多