开发者

Why is the sender of an UIMenuItem action always nil?

I've added an UIMenuItem instance to UIMenuController. When I tap in a text field twice, then I get that text editing menu with Copy, Cut, Paste, Lookup in Wikipedia.

This is my action method:

- (void)lookupInWikipedia:(id)sender {
    NSLog(%@"lookupInWikipedia: sender=%@", sender);
}

I get the NSLog when I select the "Lookup in Wikipedia" menu item. But sender is always nil.

Not even the -canPerformAction:withSender: method receives anything other than nil for sender.

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
 NSLog(@"canPerformAction:withSender: = %@", sender);
 return YES;
}
开发者_StackOverflow

Am I doing something wrong or is this a know framework bug?


I also came across that once. Looks like a bug to me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜