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

iPadOS: Prevent UIContextMenuInteraction from triggering when not using pointer

UIMenu vs UIContextMenuInteraction vs UIPointerInteraction I'm trying to set up UIContextMenuInteraction in the same way as in Files or Pages app: (Long) tap anywhere in the blank space shows the black horizontal UIMenu Secondary (Right/Control)…
4
votes
3 answers

Is it possible to customize the color of a UIMenuController?

The default background color is black. How can I change the color, similar to tintColor for navigation bars?
James Skidmore
  • 49,340
  • 32
  • 108
  • 136
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
4
votes
2 answers

Adding a dynamic custom UIMenuItem to Copy & Paste Menu before it shows

I have successfully been able to add a custom UIMenuItem to the Copy & Paste menu in my iPhone app, and even subclassed UITextView to get rid of the standard menu items. However, what I need to do is to somehow capture the fact that the menu is…
user472938
  • 128
  • 2
  • 6
4
votes
2 answers

UIWebView action sheet popup on a link - customization

I'm trying to replace or add more options into the action sheet popup in uiwebview. When touching long touch on a link standard uiwebview popup shows up. I saw some apps which did it, but i can't figure it out. the standard options are : open or…
Al B
  • 61
  • 1
  • 4
4
votes
2 answers

iPhone6 (no display zoom mode) UIMenuController truncated

I have a problem with the UIMenuController on my iPhone 6 when I use the standard display mode and device is in landscape mode. On iPhone 6 Plus the problem is in both modes. Maybe it's depends on screen resolution. In that case, the…
nlln
  • 79
  • 7
4
votes
1 answer

UIMenuController and UITextView selected text

first i am using this UITextView class textViewClass.h @interface textViewClass : UITextView textViewClass.m @implementation textViewClass - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { …
Almudhafar
  • 887
  • 1
  • 12
  • 26
4
votes
1 answer

Hiding 'select', 'selectAll', 'paste' in a UIMenuController displayed attached to a inputAccessoryView?

I am developing an app that supports editing attributedText in a UITextView. To provide the tools to the user for formatting their input, I am using an inputAccessoryView to augment the keyboard with options like bullet list, numbered list,…
Charlie
  • 310
  • 2
  • 14
4
votes
1 answer

UIMenuController in iOS7

I'm actually a little bit confused about the changes in iOS7 for displaying a customized context menu on a UITableView. My code is the following: - (void)viewDidLoad { UIMenuItem *deleteAction = [[UIMenuItem…
4
votes
1 answer

How to remove default menu items from UIMenuController?

I create a menu in UITableViewCell, this UIMenuController just has two items. but when i runing it, this menu displayed many items, seems ios default menu item, be shown as the screenshot: How can i remove those items and just display my defined…
Perchouli
  • 171
  • 1
  • 7
3
votes
1 answer

SwiftUI: Display UIMenuController (or equivalent) on tap?

I have a SwiftUI Text view in my app, and I would like to display a UIMenuController or its SwiftUI equivalent whenever I tap on it. I can capture the tap action successfully by adding an onTapGesture block to my View, but I haven't been able to…
Shadowman
  • 11,150
  • 19
  • 100
  • 198
3
votes
2 answers

show UIMenuController in UITableViewCell, grouped style

Is there a simple way to implement the copy menu when a cell is tapped, instead of subclassing the UITableViewCell? thanks, RL
Rui Lopes
  • 2,562
  • 6
  • 34
  • 49
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

PDFKit bug, need to disable UIMenuItems

I am trying to disable UIMenuItems in PDFKit. I have implemented override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { return false } But MenuItems Copy and Select All are still active. The main reason I want…
hidden-username
  • 2,610
  • 3
  • 14
  • 19
3
votes
4 answers

Passing parameter in selector (UIMenuController)

I have a UIMenuController with a "Delete" menu item on top of a collection view cell which is displayed when the user long presses on a cell with section 1: @IBAction func handleLongPressOnCell(_ sender: UILongPressGestureRecognizer) { let p =…
Cesare
  • 9,139
  • 16
  • 78
  • 130