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
3
votes
1 answer

How to add more styling options to the UIMenuController of UITextView?

When UITextView's allowsEditingTextAttributes property is enabled, textView.allowsEditingTextAttributes = true the textview can show the BIU (bold/italic/underlined) styling options in the context menu by UIMenuController. UIMenuController - BIU…
Jaehoon Lee
  • 49
  • 1
  • 5
3
votes
1 answer

uimenucontroller in uiwebview with custom menu items without MORE menu

In my iPad app, there is a UIWebview that displays text content. When I tap hold and select a text, a menu should popup with 2 custom menu. say, | MENU1 | MENU2 | But it seems the COPY menu will also accompany, which I couldn't disable. Is there…
BrianChristo
  • 193
  • 1
  • 14
3
votes
2 answers

Where to add custom menu items to UIMenuController?

I created a subclass of UITextView and now I want to extend the default UIMenuController by adding some buttons. Performing the extension is no problem at all, I just need to add some UIMenuItem so the menuItems array of the shared instance of the…
Björn Marschollek
  • 9,899
  • 9
  • 40
  • 66
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
0 answers

In UIWebview the copy/paste menu is not visible

If I set content inset to webview's scrollview, the native menu to copy/paste the text is not visible at all. When content inset (bottom) exceeds particular value than popover to copy/paste does not appear. Any help would be appreciated.
Suhaiyl
  • 1,071
  • 9
  • 17
3
votes
1 answer

Unable to show UICollectionView menu in iOS8

I'm trying to make a UIMenu appear in a collection view. I've setup my menu UIMenuItem* deleteItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"DELETE", @"Supprimer") action:@selector(deleteShow:)]; UIMenuItem* archiveItem = [[UIMenuItem…
foux
  • 81
  • 1
  • 3
3
votes
1 answer

iOS 7 - UIWebView extended menu

I want to add additional menu item for the menu that appears when some text is selected. I have added the code below to viewDidLoad: NSMutableArray *extraItems = [[NSMutableArray alloc] init]; UIMenuItem *boldItem = [[UIMenuItem alloc]…
Matrosov Oleksandr
  • 25,505
  • 44
  • 151
  • 277
3
votes
1 answer

How do you create a UIMenuController for something that is not text-based?

Apple's Messages app, as well as many other third party apps support a UIMenuController style popover for selecting messages. However, in browsing the documentation it seems that it's only used for text related selection. Is it possible to extend…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
3
votes
1 answer

How can I add a menu option to the NSTextAttachment popup menu is UITextView?

I want to add another menu option to the default image attachment menu options (Copy Image, Save to Camera Roll). Note that these options are shown when you long press on an image embedded in the UITextView if the textView is not in editing mode. I…
Duncan Groenewald
  • 8,496
  • 6
  • 41
  • 76
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

How to remove Copy,Select All,Define menuItem from UIMenuController

As my this question Display i want to display pop up when user select the text. and in that pop up detail about that word will be displayed. But i didn't get any satisfactory answer so i have change my logic. Now i want to display one item like…
user2452016
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
3
votes
0 answers

UIMenuController with Images

Can anyone provide an example of how to display images in a UIMenuController? In iBooks, if you select some text and then choose Highlight from the displayed menu, it will switch to a contextual highlight menu that has images in it. I am already…
DenVog
  • 4,226
  • 3
  • 43
  • 72
3
votes
1 answer

UIMenuController not showing UIPasteBoard is cleared iPhone app?

Am working in message based iPhone application. In my application looking like iMessage native iOS app. 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…
Yuvaraj.M
  • 9,741
  • 16
  • 71
  • 100
3
votes
2 answers

Hide Copy and Deselect UITextView options after copying all text

I am working on a messaging app. I want to give a "copy" option to the user when they enter their message in a UITextView. When the user presses the "copy" button, it is copying the message, but the popover shows again and again, and the text is…
Gopinath
  • 5,392
  • 21
  • 64
  • 97