views:

258

answers:

2

Hello,

I'm using the new customization abilities of the UIMenuController to add things other than "Copy" to the menu for cut&paste into a webview.

What I do is getting the reference to the shared UIMenuController, setting my NSArray of UIMenuItems into the menuItems, and everything work fine as long as I add a single item. For instance I see [COPY|FOOBAR].

Instead if I try adding more than a single item, what happen is that I see [COPY|MORE], if I press into MORE than finally the other items will show up.

Is possible to show directly [COPY|FOO|BAR|THREE|FOUR] instead? I saw a few applications that are able to do this, notably iBooks.

Any help very appreaciated, thank you.

Cheers, sissensio

+2  A: 

Hi, we have the same problem actually when i tried to develop an application in iPad. But what i did is i disabled the popup menu items in

  • (BOOL)canPerformAction:(SEL)action withSender:(id)sender

Using

if ( [UIMenuController sharedMenuController] ) { [UIMenuController sharedMenuController].menuVisible = NO; } return NO;

Then i used a UIPopoverController.

Regards, ZaldzBugz

ZaldzBugz
That's very clever. I might have to try that.
Sam Soffes
A: 

Ran into the same problem and what I did was override the webview with a subclass (yep I know you shouldn't) and return NO for canPerformAction: for the copy: selector. Then I added my own Copy item to the ShareMenuController that calls the original method from UIWebview. That way as many items as you want can be added and are initially visible.

fluXa