Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. @interface AlertViewCallback : NSObject <UIAlertViewDelegate>
  2. @property (copy, nonatomic) void (^callback)(void);
  3. @end
  4.  
  5. @implementation AlertViewCallback
  6.  
  7. + (instancetype)callback:(void (^)(void))callback {
  8. return [[self alloc] initWithCallback:callback];
  9. }
  10.  
  11. - (instancetype)initWithCallback:(void (^)(void))callback {
  12. self = [super init];
  13. if (self) {
  14. self.callback = callback;
  15. }
  16. return self;
  17. }
  18.  
  19. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
  20. self.callback();
  21. }
  22.  
  23. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement