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

Customize UIMenuController

Hi I want to create a customize bubble menu, like cut/copy/paste menu, in IPhone SDK3.x. I know it is UIMenuController but it is only provide standard cut/copy/past menu. Anyone know how to make a bubble menu similar like this. Any example and…
interman
  • 141
  • 1
  • 2
  • 9
6
votes
3 answers

UIMenuController hides the keyboard

I currently have an application which is for chatting. I used a UItextField for input box and bubbles for display messages, some thing like the system SMS. I want to enable copy paste on the message bubbles (labels). The problem is, when I want to…
Anurag Kabra
  • 444
  • 1
  • 5
  • 18
6
votes
2 answers

Removing default cut, copy, paste from UIMenuController in a TableView

I'm trying to remove the default menu items from UIMenuController. I found this post for UIWebview or UITextView: How to remove the default UIMenuItem from the UIMenuController in iOS? I'm trying to do this for the new iOS 5 methods where you can…
Crystal
  • 28,460
  • 62
  • 219
  • 393
5
votes
1 answer

How do I add this menu in iOS to an app? Menu similar to textfield in iPhone?

I would like to know how to implement this "context menu" with action buttons like the one that appears on whatsapp and other apps when you click message. Thank you very much.
Eironeia
  • 771
  • 8
  • 20
5
votes
2 answers

How to deselect selected text in an iPad application

I have a custom menu item (UIMenuItem) attached to a UIWebView. When the user selects my custom menu item after selecting some text in the web view, I want to "deslect" the current text selection. The problem is that the edit menu will pop up…
Robert Stewart
  • 201
  • 5
  • 10
5
votes
2 answers

Removing Copy, Look Up, and Share from UIMenuController

I am trying to override the default UIMenuController so that only my custom item "Define..." appears when the user selects text in its text view. I haven't had much luck with the approaches I've found online thus far. To be more specific, I have…
Gaius Davidius
  • 143
  • 2
  • 10
5
votes
1 answer

How does Apple access UIWebView PDF strings for sharedMenuController items?

I'm trying to access the strings in a PDF loaded remotely in a UIWebView. Since Apple has the copy/define options listed for the UIMenuController items, i thought it would be just as easy as implementing the stringByEvaluatingJavaScriptFromString…
soulshined
  • 9,612
  • 5
  • 44
  • 79
5
votes
3 answers

Pass value through UIMenuItem of UIMenuController

I am using following method to show menu on long press in UITableViewCell. I have need to pass a value pressing Delete menu Item to -(void)numberDelete method. -(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer { …
MD SHAHIDUL ISLAM
  • 14,325
  • 6
  • 82
  • 89
5
votes
3 answers

Change language used in copy/paste menu to something other than English

I have set "Localization native development region" to "France" in my Info.plist. Nevertheless, the copy/paste menu on a UITextField is still in English. I do not understand why, and I guess the app is still in English. What setting do I need to…
user2206906
  • 1,310
  • 2
  • 13
  • 18
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…
5
votes
4 answers

UITEXTVIEW: Get the recent word typed in uitextview

I want to get the most recent word entered by the user from the UITextView. The user can enter a word anywhere in the UITextView, in the middle or in the end or in the beginning. I would consider it a word when the user finishes typing it and…
Noor Syed
  • 630
  • 3
  • 7
  • 16
4
votes
1 answer

facing trouble while using uimenucontroller

I need to use uimenucontroller in my app, where i want copy/paste/etc options, when ever i move any selected uiview/uiimageView present in uiviewcontroller. here is the code i am using: { UIMenuController *menuController = [UIMenuController…
vensan
  • 319
  • 1
  • 3
  • 11
4
votes
1 answer

Customize menu : Using UIEditMenuInteraction in WKWebView (iOS 16)

How can we use UIEditMenuInteraction in WkWebViewUITextView to customize menu and add more buttons? Before iOS 16 I was using: UIMenuController.shared.menuItems = [menuItem1, menuItem2, menuItem3] in override func canPerformAction(_ action:…
dibs
  • 174
  • 1
  • 12
4
votes
1 answer

Setter for 'isMenuVisible' was deprecated in iOS 13.0

In iOS 13.0, Setter for 'isMenuVisible' was deprecated, What is alternate of isMenuVisible in iOS 13 (Swift 5+)? UIMenuController.shared.isMenuVisible = false
yo2bh
  • 1,356
  • 1
  • 14
  • 26
1 2
3
18 19