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
2
votes
2 answers

How to Remove UIMenuController Default Items In Swift

I'm trying to remove the items Look Up & Share... from the UIMenuController. How would I specifically remove the two and keep my custom one. Here is what I've achieved so far: override func viewDidAppear(_ animated: Bool) { …
MGames
  • 1,171
  • 2
  • 13
  • 24
2
votes
2 answers

Add a UIMenuItem for a specific UITextView?

I have a lot of UITextViews in my screen and i want to add a new custom UIMenuItem for one of them. It is possible to add a custom UIMenuItem just for a specific UITextView? I use below code but i have my custom button for all…
Gaby Fitcal
  • 1,814
  • 1
  • 17
  • 28
2
votes
4 answers

How to disable Copy & Define UIMenuItems of UIMenuController in UITextfield

I am implementing custom UIMenuController and trying to figure out. How can I legally disable "Copy" and "Define" UIMenuItems of UIMenuController in UITextfield? Textfield is not editable. I tried to disable "Copy"…
Adelmaer
  • 2,209
  • 3
  • 22
  • 45
2
votes
0 answers

iOS: UIMenuItem menu cut-off

I have 2 locations on my app that I use a UILongPressGestureRecognizer to show a menu with 2 choices. The two locations, Left and Right, are UILabels that display numbers. A long press on the number will popup a menu with options to either "Reset…
fsb
  • 290
  • 10
  • 28
2
votes
2 answers

Custom UIMenuController issue

I have a UITable and a UITextView on a View Controller. I want to have a custom UIMenuController with options 'Copy' and 'Info' when I longpress the tableviewcell and I want to have the default UIMenuController on longpress of UITextView. I searched…
user2307725
2
votes
2 answers

How to display more than one line in UIMenuItem?

I'm trying to display more than one line of text in a custom UIMenuItem. I've tried using a simple "\n" in the title property of the UIMenuItem but with no luck. Example: UIMenuItem *menuItem; //Is then allocated properly.... // Before the Menu is…
Joss
  • 903
  • 10
  • 17
2
votes
3 answers

Custom UIMenuItem only showed first time

I have added an custom menu in the - (void)viewDidLoad method of my view controller: UIMenuItem *menuItem = [[UIMenuItem alloc] initWithTitle:@"Read selected" action:@selector(readSelectedText)]; [UIMenuController sharedMenuController].menuItems =…
pajevic
  • 4,607
  • 4
  • 39
  • 73
1
vote
0 answers

using CompositionalLayout, and there is a problem that the item disappears for a while when I scroll after calling UIMenu

enter image description here Hello. Three sections were constructed using CompositionalLayout, and there is a problem that the item disappears for a while when I scroll after calling UIMenu. If anyone knows the cause or solution of the problem,…
1
vote
1 answer

SwiftUI : custom pop menu in WKWebView

In My Swift project, I use a wkWebView to display HTML content retrieved from a webservice. Everything works. I would like to go further and allow the user to report a fault through the menu when part of the text is selected. Instead of proposing…
dibs
  • 174
  • 1
  • 12
1
vote
1 answer

How can I set a button on the selected position of the view?

I'm very new to iOS development, but I'm struggling with the view's position thing. On a single view controller, I tried to make a circle on the view by long-pressing the view but I can only make it at the center of the view. Do you know how to…
willB
  • 35
  • 5
1
vote
0 answers

UIMenuController in iOS 13 beta shows with transparent background instead of black background

I am using UIMenuController to display custom options. It was working fine with a black background and white text on UIMenuItems till iOS 12. After upgrading to iOS 13 beta 8 with Xcode 11 beta 7, the background changed to transparent. Is there…
Rishabh Wadhwa
  • 171
  • 2
  • 8
1
vote
2 answers

Multiple UIMenuItem with the same selector

Hy guys, i create multiple UIMenuItem with the same selector: ["first", "second", "third"].forEach({ (menu) in let b = UIMenuItem(title: menu, action: #selector(target.tap(sender:))) }) @objc public func click(sender: UIMenuItem){ …
Luca Becchetti
  • 1,210
  • 1
  • 12
  • 28
1
vote
0 answers

Use UIMenuItem inside UItableView

I am new user as iPhone developer, actually I want to use UIMenuItem inside UITableView and I'm trying to achieve below image. I want to create some shadow effect which you can see in the bottom of table view. If I put one image on the tableView…
1
vote
1 answer

UIMenuItem disabled auto selector on method

I have a problem with create new UIMenuItem and assigning it a selector. Problem is it automatically call its selector without tapping it. This is my code: let customMenuItem1 = UIMenuItem(title: "Salvează", action: Selector(showNote())) …
Tcacenco Daniel
  • 445
  • 7
  • 17
1
vote
1 answer

UIMenuContoller UIMenuItem custom action with multiple parameters?

I'm creating my custom UIMenuItem and adding it to shared UIMenuController's menuItems aray: let menuItemCustom = UIMenuItem(title: "Custom action", action: "customAction:") UIMenuController.sharedMenuController().menuItems = [menuItemCustom] Then…
Nikola Milicevic
  • 2,886
  • 3
  • 17
  • 17