Question

Apple's Messages app, as well as many other third party apps support a UIMenuController style popover for selecting messages.

enter image description here

However, in browsing the documentation it seems that it's only used for text related selection.

Is it possible to extend it to other UIViews?

Was it helpful?

Solution

It's part of the tableView delegate API: http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:shouldShowMenuForRowAtIndexPath

-(void)tableView:(UITableView*)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath*)indexPath withSender:(id)sender;
-(BOOL)tableView:(UITableView*)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath*)indexPath withSender:(id)sender;
-(BOOL)tableView:(UITableView*)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath*)indexPath; 

Beyond that, the canPerformAction: responder API can be used to support actions, but you will be responsible for displaying the menu using UIMenuController.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top