Hacking Block Support Into UIMenuItem

1 · Peter Steinberger · July 17, 2012, 2:22 p.m.
tl;dr: UIMenuItem! Blocks! Get the code on GitHub. While developing a new version of PSPDFKit, I started using UIMenuController more and more. The first thing you’ll notice is that it’s different from your typical target/action pattern, in that the target is missing: 1 [UIMenuItem alloc] initWithTitle:@"Title" action:@selector(menuItemAction:)]; This is actually pretty genius, in part. iOS checks if the @selector can be invoked calling canPerformAction:withSender:, which is part of UIResponder....