BlocksKit を使ってみたので簡単な使い方を書いておく
例えば UIAlertView を利用する場合、 こんな感じで使える。便利〜。
#import "UIAlertView+BlocksKit.h" [UIAlertView bk_showAlertViewWithTitle:@"title" message:@"message" cancelButtonTitle:@"cancel" otherButtonTitles:@[@"ok"] handler:^(UIAlertView *alertView, NSInteger buttonIndex) { NSLog(@"%@", alertView); NSLog(@"%d", buttonIndex); }];
※ BlocksKit はカテゴリ拡張なので bk_xxx メソッドを利用すること
参考:https://github.com/zwaldowski/BlocksKit/blob/master/BlocksKit/UIKit/UIAlertView%2BBlocksKit.h