Questions tagged [uimenucontroller]

The singleton UIMenuController instance presents the menu interface for the Cut, Copy, Paste, Select, Select All, and Delete commands. This menu is referred to as the editing menu. When you make this menu visible, UIMenuController positions it relative to a target rectangle on the screen; this rectangle usually defines a selection. The menu appears above the target rectangle or, if there is not enough space for it, below it.

The singleton UIMenuController instance presents an Editing Menu. You can create an instance like this

    UIMenuController *menuController = [UIMenuController sharedMenuController]; 

You can position it relative to a target rectangle on the screen which usually defines a selection.

An example implementation of UIMenuController (assuming you are coding for at least iOS 3.2 ()):

    UIMenuController *menuController = [UIMenuController sharedMenuController];
    UIMenuItem *menuItem = [[UIMenuItem alloc] initWithTitle:@"title" action:@selector(aMethod:)];
    UIMenuItem *menuItem1 = [[UIMenuItem alloc] initWithTitle:@"title" action:@selector(anotherMethod:)];
    [menuController setMenuItems:[NSArray arrayWithObjects:menuItem, menuItem1, nil]];
    [menuController setTargetRect:CGRectMake(location.x, location.y, 0, 0) inView: someView];
    [menuController setMenuVisible:YES animated:YES];
    menuController.arrowDirection= UIMenuControllerArrowLeft; 
    [resetMenuItem release];

References:

277 questions
2
votes
1 answer

Setting UIMenuController arrow direction not working

I have a UIMenuController which I have added a few extra items to. I would like the menu to be BELOW the text that I select, so I tried: [UIMenuController sharedMenuController].arrowDirection = UIMenuControllerArrowDown; That seemed to do nothing,…
Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
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
0 answers

UIMenuController doesn't show up

I'm trying to fix an issue for two days but I really don't know what to do. I tried several solutions but nothing helped. This is the situation: I have a UIViewController and I've added a subclass of UITextView as subview. -(void)viewDidLoad { …
Ram2048
  • 55
  • 3
2
votes
1 answer

Another UIMenuController won't display problem

and thanks in advance for your help. I assure you that I've read most everything on here about UIMenuController problems. I really think I've covered it all. Clearly I've missed something. In a nutshell, I'm trying to replicate the "Replace ..."…
BarryD
  • 41
  • 6
2
votes
0 answers

How to customize the Menu controller with menus having an images in iPad?

Iam developing an iPad application which includes UIMenuController, I integrated the Menu controller which shows my own titles. But I need to show images instead of titles in the Menu controller. Could anybody have a suggestion to implement…
Srinivas G
  • 339
  • 3
  • 16
2
votes
2 answers

How to remove UIMenuController item in swift?

I want remove UIMenuController item. This textfield is not a UITextField. That textfield is UIWebView's textfield. Not owned native. And I tried this. override func viewDidLoad() { super.viewDidLoad() ... …
user9494956
2
votes
1 answer

How to add custom menuItem in specified position of UIMenuController?

There are five default menu items in the UIMenuController: Cut, Copy, Paste, Look Up, Share... I want to add one custom menuItem "Paste and Search" between menu "Paste" and "Look Up".
lypw2009
  • 201
  • 3
  • 11
2
votes
3 answers

Getting selected text when UIMenuController is shown

When the user selects some text in UITextView or UIWebView, UIMenuController is shown. Is there any way to access this selected text programmitically? I need it because I want to add custom item to UIMenuController: 'Search' option which will be…
manicaesar
  • 5,024
  • 3
  • 26
  • 29
2
votes
1 answer

Display copy after select text from textview using swift

Using this code it will show me : copy, select, select all and paste. But I want select and select all first when user click on select then and then copy will display and when click on copy then paste will display. class CustomTextField:…
Mili Shah
  • 1,456
  • 13
  • 21
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
0 answers

UILabel with UIMenuController - Copy text in UIPasteboard

I've a UILable with text "This is label with UIMenuController". I've added UILongPressGesture on label and open UIMenuController from it. Menu controller considers frame of UILable as a source view (as it's its natural behavior), but I want specific…
Krunal
  • 77,632
  • 48
  • 245
  • 261
2
votes
1 answer

Why is the sender of an UIMenuItem action always nil?

I've added an UIMenuItem instance to UIMenuController. When I tap in a text field twice, then I get that text editing menu with Copy, Cut, Paste, Lookup in Wikipedia. This is my action method: - (void)lookupInWikipedia:(id)sender { …
Proud Member
  • 40,078
  • 47
  • 146
  • 231
2
votes
0 answers

UIActivityController not showing from bottom

I am using TextView which has a default property copy, lookup, share etc. when i click on share ativityController appears but it's not appearing from bottom, can we change the frame position? Here is the image of what I am getting,
bikram sapkota
  • 1,106
  • 1
  • 13
  • 18
2
votes
1 answer

Trouble Displaying UIMenuController When Cell Tapped In UITableView

I'm trying to display a custom UIMenuController when a User long presses on a cell in a grouped UITableView. However, I can't seem to get the UIMenuController to display after successfully detecting the long press. Any help is greatly appreciated.…
aahrens
  • 5,522
  • 7
  • 39
  • 63