Created
September 20, 2011 10:22
-
-
Save eaigner/1228804 to your computer and use it in GitHub Desktop.
Blocks as action target
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming ARC is enabled. | |
// |button| is of type UIButton (works with NSButton as well). | |
[button addTarget:[^{ NSLog(@"Block invoked."); } copy] | |
action:@selector(invoke) | |
forControlEvents:UIControlEventTouchUpInside]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment