You need to use a UIMenuController. If you don't want Copy/Paste/Cut, you'll include something like this in your canPerformAction:
method:
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if(action == @selector(someSelector:))
return YES;
else
return NO;
}
Creating a new menu item looks like this:
UIMenuItem *someAction = [[UIMenuItem alloc]initWithTitle:@"Something" action:@selector(doSomething:)];
UIMenuController *menu = [UIMenuController sharedMenuController];
menu.menuItems = [NSArray arrayWithObject:someAction];
[menu update];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…