【问题标题】:How to add a button to iOS text selection action control如何向 iOS 文本选择操作控件添加按钮
【发布时间】:2013-11-25 19:06:04
【问题描述】:

有谁知道我如何将示例中的“共享”按钮之类的按钮添加到这种控件中。我有一个 UIWebView,我想在用户选择其中的文本后为用户提供特殊操作。

Example image here

【问题讨论】:

    标签: ios text controls selection share


    【解决方案1】:

    菜单是UIMenuController 的一个实例。您可以将自己的项目添加到menuItems 属性并实现canPerformAction:withSender: 以确定该项目是否适合显示。

    【讨论】:

      【解决方案2】:
      UIMenuItem *item = [[UIMenuItem alloc] initWithTitle: @"Title"
                                                     action: @selector(methodToFire:)] ;
      [[UIMenuController sharedMenuController] setMenuItems: [NSArray arrayWithObject: item]];
      

      【讨论】:

        猜你喜欢
        • 2014-08-03
        • 1970-01-01
        • 1970-01-01
        • 2013-04-18
        • 1970-01-01
        • 1970-01-01
        • 2018-02-18
        • 2012-09-23
        相关资源
        最近更新 更多