Skip to content

Instantly share code, notes, and snippets.

@rpetrich
Created September 23, 2010 16:00
Show Gist options
  • Save rpetrich/593866 to your computer and use it in GitHub Desktop.
Save rpetrich/593866 to your computer and use it in GitHub Desktop.
#import <UIKit/UIKit.h>
#import <ActionMenu/ActionMenu.h>
@implementation UIResponder (TestAction)
- (BOOL)canDoTestAction:(id)sender
{
// Always
return YES;
}
- (void)doTestAction:(id)sender
{
UIAlertView *av = [[UIAlertView alloc] initWithTitle:[[self class] description] message:[self selectedTextualRepresentation] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[av show];
[av release];
}
+ (void)load
{
[[UIMenuController sharedMenuController] registerAction:@selector(doTestAction:) title:@"Test" canPerform:@selector(canDoTestAction:)];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment