In this answer: Can I pass a block as a @selector with Objective-C?
Lemnar says you could do this:
id block = [^{NSLog(@"Hello, world");} copy];// Don't forget to -release.
[button addTarget:block
action:@selector(invoke)
forControlEvents:UIControlEventTouchUpInside];
Where exactly should it be released? Where I'd like to use it, is in the viewDidLoad method, so viewDidUnload seems like the place to release it, but is there any way to release it without creating an ivar?