Skip to content

Instantly share code, notes, and snippets.

@justbuchanan
Last active December 21, 2015 00:58
Show Gist options
  • Save justbuchanan/6223895 to your computer and use it in GitHub Desktop.
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
@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