Last active
December 21, 2015 00:58
-
-
Save justbuchanan/6223895 to your computer and use it in GitHub Desktop.
Demo of the UIKit delegate behavior described in this pull request: https://github.com/ReactiveCocoa/ReactiveCocoa/pull/745
This file contains 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
@interface Delegate : NSObject <UIActionSheetDelegate> | |
@end | |
@implementation Delegate | |
- (BOOL)respondsToSelector:(SEL)aSelector { | |
NSLog(@"-respondsToSelector: '%@'", NSStringFromSelector(aSelector)); | |
return YES; | |
} | |
@end | |
/* | |
* call this method and you'll see that the delegate is asked if it | |
* responds to each of the optional methods in the UIActionSheetDelegate protocol | |
*/ | |
- (void)tryIt { | |
Delegate *d = [[Delegate alloc] init]; | |
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil | |
delegate:d | |
cancelButtonTitle:@"Cancel" | |
destructiveButtonTitle:@"Destroy" | |
otherButtonTitles:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment