Created
January 29, 2015 23:18
-
-
Save blixt/4bb46c0672ed8facb19a to your computer and use it in GitHub Desktop.
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
@interface AlertViewCallback : NSObject <UIAlertViewDelegate> | |
@property (copy, nonatomic) void (^callback)(void); | |
@end | |
@implementation AlertViewCallback | |
+ (instancetype)callback:(void (^)(void))callback { | |
return [[self alloc] initWithCallback:callback]; | |
} | |
- (instancetype)initWithCallback:(void (^)(void))callback { | |
self = [super init]; | |
if (self) { | |
self.callback = callback; | |
} | |
return self; | |
} | |
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { | |
self.callback(); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment