문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top