Created
February 17, 2014 14:27
-
-
Save jazzsasori/9051537 to your computer and use it in GitHub Desktop.
BlocksKit 2.0
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
// 今までの書き方 | |
#import <BlocksKit/BlocksKit.h> | |
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
[button addEventHandler:^(id sender) { | |
// do something | |
} forControlEvents:UIControlEventTouchUpInside]; | |
// 2.0の書き方 | |
#import <BlocksKit/BlocksKit.h> | |
#import <BlocksKit/BlocksKit+UIKit.h> // こいつをインポートする必要があります。 ※ はまりました… | |
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
[button bk_addEventHandler:^(id sender) { // bk_プレフィックスが追加されました。 | |
// do something | |
} forControlEvents:UIControlEventTouchUpInside]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment