uimenucontroller

How to get UIMenuController work for a custom view?

落爺英雄遲暮 提交于 2019-11-27 11:09:04
I'm trying to get the following code work: UIMenuController * menu = [UIMenuController sharedMenuController]; [menu setTargetRect: CGRectMake(100, 100, 100, 100) inView: self.view]; [menu setMenuVisible: YES animated: YES]; The menu instance is ready but it doesn't show - the width is always zero. Or is there some sample code on this UIPasteboard/UIMenuController topic? krasnyk I was not able to get it working even when I read all of your answers. I'm presenting ready code that will work for everyone. Let's say we have a controller class named Controller. You can simply paste the following

How do you REALLY remove Copy from UIMenuController

 ̄綄美尐妖づ 提交于 2019-11-27 04:17:54
问题 There apparently used to be an easy way to prevent the "More..." label from appearing in UIMenuController when you added more than one custom menu item. You just had to remove all of the system menu items. There was even a workaround here for still having copy work. You just had to implement a custom copy command using a different selector and then override canPerformAction:withSender: to not show the system copy: -(BOOL)canPerformAction:(SEL)action withSender:(id)sender { if (action ==

IOS UIMenuController UIMenuItem, how to determine item selected with generic selector method

时间秒杀一切 提交于 2019-11-27 03:30:39
问题 With the following setup .... MyUIMenuItem *someAction = [[MyUIMenuItem alloc]initWithTitle : @"Something" action : @selector(menuItemSelected:)]; MyUIMenuItem *someAction2 = [[MyUIMenuItem alloc]initWithTitle : @"Something2" action : @selector(menuItemSelected:)]; .... - (IBAction) menuItemSelected : (id) sender { UIMenuController *mmi = (UIMenuController*) sender; } How to figure out which menu item was selected. And don't say that you need to have two methods... Thanks in advance. 回答1:

How to show a custom UIMenuItem for a UITableViewCell?

江枫思渺然 提交于 2019-11-27 00:46:26
I want the UIMenuController that pops up when I long-press a UITableViewCell to show custom UIMenuItems. I set up the custom item in viewDidLoad UIMenuItem *testMenuItem = [[UIMenuItem alloc] initWithTitle:@"Test" action:@selector(test:)]; [[UIMenuController sharedMenuController] setMenuItems: @[testMenuItem]]; And then I set all the right delegate methods. - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } -(BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender

UIMenuController Custom Items

你。 提交于 2019-11-26 19:16:10
问题 I have created a UIMenuController and have set it a custom menu item like so: UIMenuController *menuController = [UIMenuController sharedMenuController]; UIMenuItem *item1 = [[UIMenuItem alloc] initWithTitle:@"Do This" action:@selector(item1)]; [menuController setMenuItems:[NSArray arrayWithObject:item1]]; But I wanted that object to be the only one to appear so I added this code: - (BOOL)canPerformAction: (SEL)action withSender: (id)sender { BOOL answer = NO; if (action == @selector(item1))

Customize UIMenuController

一世执手 提交于 2019-11-26 19:15:51
问题 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 code for reference? 回答1: 1) you need to add custom menu items to the shared UIMenuController: UIMenuItem* miCustom1 = [[[UIMenuItem alloc] initWithTitle: @"Custom 1" action:@selector( onCustom1: )] autorelease]; UIMenuItem* miCustom2 = [[[UIMenuItem

UIMenuController not showing up

坚强是说给别人听的谎言 提交于 2019-11-26 15:30:22
问题 I'm trying to create a custom UIMenuController and display it in my view. Here's my code: UIMenuController *menuController = [UIMenuController sharedMenuController]; UIMenuItem *listMenuItem = [[UIMenuItem alloc] initWithTitle:@"List" action:@selector(addList:)]; [menuController setMenuItems:[NSArray arrayWithObject:listMenuItem]]; [menuController setTargetRect:CGRectMake(50.0, 50.0, 0, 0) inView:self.view]; [menuController setMenuVisible:YES animated:YES]; [listMenuItem release]; There are

How to get UIMenuController work for a custom view?

戏子无情 提交于 2019-11-26 15:27:14
问题 I'm trying to get the following code work: UIMenuController * menu = [UIMenuController sharedMenuController]; [menu setTargetRect: CGRectMake(100, 100, 100, 100) inView: self.view]; [menu setMenuVisible: YES animated: YES]; The menu instance is ready but it doesn't show - the width is always zero. Or is there some sample code on this UIPasteboard/UIMenuController topic? 回答1: I was not able to get it working even when I read all of your answers. I'm presenting ready code that will work for

How to show a custom UIMenuItem for a UITableViewCell?

强颜欢笑 提交于 2019-11-26 09:26:12
问题 I want the UIMenuController that pops up when I long-press a UITableViewCell to show custom UIMenuItems. I set up the custom item in viewDidLoad UIMenuItem *testMenuItem = [[UIMenuItem alloc] initWithTitle:@\"Test\" action:@selector(test:)]; [[UIMenuController sharedMenuController] setMenuItems: @[testMenuItem]]; And then I set all the right delegate methods. - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } -(BOOL)tableView: