Questions tagged [uimenuitem]

An instance of the UIMenuItem class represents a custom item in the editing menu managed by the UIMenuController object. Custom menu items appear in the menu after any validated system items. A UIMenuItem object has two properties: a title and an action selector identifying the method to invoke in the handling responder object. Targets are not specified; a suitable target is found via normal traversal of the responder chain.

Available in iOS 3.2 and later in UIKit.

An instance of the UIMenuItem class represents a custom item in the editing menu managed by the UIMenuController object.

Custom menu items appear in the menu after any validated system items. A UIMenuItem object has two properties: a title and an action selector identifying the method to invoke in the handling responder object. Targets are not specified; a suitable target is found via normal traversal of the responder chain. To have custom menu items appear in the editing menu, you must add them to the menuItems property of the UIMenuController object.

54 questions
10
votes
3 answers

Load a remote image in a MenuItem using Glide

Usually if I want to load an image with Glide I would write the following: Glide.with(context) .load(theURLOftheImage) .error(R.drawable.ic_error_image) .into(theImageView); but what if I need to load the image of that URL into a…
AlvaroSantisteban
  • 5,256
  • 4
  • 41
  • 62
6
votes
2 answers

iOS 14 Context Menu from UIView (Not from UIButton or UIBarButtonItem)

There is an easy way to present a context menu in iOS 13/14 via UIContextMenuInteraction: anyUIView.addInteraction(UIContextMenuInteraction(delegate: self)) The problem for me with this is that it blurs out the whole user interface. Also, this only…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
5
votes
2 answers

UIMenuItem #selector method crash in wkwebview

UIMenuItem selector method crashes in iOS 11 beta SDK. -[WKContentView highlightText]: unrecognized selector sent to instance 0x7f85df8f3200 Method Definition: func highlightText() { // } I try to add UIMenuItem in WKWebView, let…
5
votes
1 answer

Set accessibilityLabel on UIMenuItem

I am trying to set the accessibilityLabel of a UIMenuItem and it seems to have no effect. VoiceOver simply reads the title of the item no matter what: let foo = UIMenuItem(title: "foo", action: #selector(doSomething)) …
Jon Brooks
  • 2,472
  • 24
  • 32
5
votes
1 answer

UIMenuController not getting displayed

I am displaying UIMenuController on long press & double tap gesture, but its not getting displayed. I have followed the answers given here but it still not showing up. UIMenuController not showing up Below is my code - (void)…
JiteshW
  • 2,195
  • 4
  • 32
  • 61
5
votes
3 answers

Can't get UIMenuController to show custom items

So, I am not sure if I am doing something wrong here, but I have a UIViewController that has a UICollectionView on it. In the UIViewController's viewDidLoad method, I do the following it doesn't add any custom menu items to the popup that shows…
4
votes
1 answer

Cannot Disable Default UIMenuItems in UIMenuController in UITextView

I'm trying to configure UIMenuController's menu items for a functionality similar to Medium's iOS feature: There are a variety of threads devoted to this specific task, but despite tens of thousands of views and varied results, including it not…
Pigpocket
  • 449
  • 5
  • 24
3
votes
0 answers

UIMenuController submenu

I'm trying to implement an UIMenuController with some UIMenuItems in a Mac Catalyst app with the following: let menu = UIMenuController.shared menu.menuItems = [itemA(), itemB(), itemC()] menu.showMenu(from: someView, rect: someView.bounds) //…
Ivan Cantarino
  • 3,058
  • 4
  • 34
  • 73
3
votes
1 answer

UIMenuController doesn't update menu for first time

I have UITextView on which I want to add highlight as custom menu item. I have registered to following notification UIMenuControllerWillShowMenuNotification. The method for the notification is something like this: if textIsHighlighted { let…
meteors
  • 1,747
  • 3
  • 20
  • 40
3
votes
3 answers

Remove "Copy" menu item from programatically created UITextView IOS

I create my UITextView programmatically in my viewDidLoad. When i select a text, the menu shows me the following : As it shows, i have added two custom buttons the highlight and unhighlight. I would like to remove the " copy " option and keep all…
Elias Rahme
  • 2,226
  • 3
  • 28
  • 53
3
votes
0 answers

iOS hiding UIMenuContoller for good in all screens and with all UIControls

I am trying to disable the UIMenuController across the application and I am using the below code [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(menuWillBeShown) name:UIMenuControllerWillShowMenuNotification…
Satheesh
  • 10,998
  • 6
  • 50
  • 93
3
votes
1 answer

iOS: Multiple UIMenuItems with single selector

I am new to iOS development and I am working on UIMenuController. It looks like we need to have a different selector for each UIMenuItem. Is there a way to have a single selector and determine which item I clicked? Can we send an argument to the…
rahul
  • 6,447
  • 3
  • 31
  • 42
2
votes
1 answer

How to insert an option within the menu that appears when text is selected in SwiftUI?

I am developing an application with SwiftUI where i would like to insert an option in the menu that appears when text is selected, it was a custom item for this menu. I want to know if it was possible to make this feature. thanks
agmcoder
  • 195
  • 1
  • 8
2
votes
0 answers

Is it possible to prevent UIMenuController from being dismissed when one of it's UIMenuItems is selected?

The default behaviour is that selecting an item will dismiss the menu. I see that some Apple's apps have items which will do some action but keep the menu open. For example in Notes, there is Indent item which will indent the text but keep the menu…
Artium
  • 5,147
  • 8
  • 39
  • 60
2
votes
1 answer

Override "Look Up" menu item on iOS

When you select text in iOS one of the menu items is called "Look Up". Is it possible to override this behavior and display your own view controller?
Berry Blue
  • 15,330
  • 18
  • 62
  • 113
1
2 3 4