This file contains 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 "NSObject+Extensions.h" | |
@implementation NSObject (Extensions) | |
- (void)performBlock:(VoidBlock)block { | |
[self performSelector:@selector(executeBlock:) withObject:[block copy]]; | |
} | |
- (void)performBlock:(VoidBlock)block afterDelay:(NSTimeInterval)delay { | |
[self performSelector:@selector(executeBlock:) withObject:[block copy] afterDelay:delay]; |
This file contains 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 NSObject (Extensions) | |
typedef void (^VoidBlock)(void); | |
- (void)performBlock:(VoidBlock)block; | |
- (void)performBlock:(VoidBlock)block afterDelay:(NSTimeInterval)delay; | |
- (void)performBlockOnMainThread:(VoidBlock)block; | |
- (void)performBlockOnMainThread:(VoidBlock)block afterDelay:(NSTimeInterval)delay; | |
- (void)performBlockInBackground:(VoidBlock)block; |
This file contains 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 "NSObject+Extensions.h" | |
… | |
- (void)doSomething { | |
[self performBlockInBackground:^{ | |
NSLog(@"バックグラウンド処理でごにょごにょ"); | |
}]; | |
} |
This file contains 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 "NSObject+Extensions.h" | |
@implementation NSObject (Extensions) | |
- (void)performBlockInBackground:(VoidBlock)block { | |
[self performSelectorInBackground:@selector(executeBlockInAutoReleasePool:) withObject:[block copy]]; | |
} | |
- (void)executeBlockInAutoReleasePool:(VoidBlock)block { | |
@autoreleasepool { |
This file contains 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 <Foundation/Foundation.h> | |
@interface NSObject (Extensions) | |
typedef void (^VoidBlock)(void); | |
- (void)performBlockInBackground:(VoidBlock)block; | |
@end |
This file contains 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
… | |
- (void)doSomething { | |
[self performSelectorInBackground:@selector(doSomethingInBackground) withObject:nil]; | |
} | |
- (void)doSomethingInBackground { | |
NSLog(@"バックグラウンド処理でごにょごにょ"); | |
} |
This file contains 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
【参考】 | |
http://d.hatena.ne.jp/hnw/20110528 | |
【事前準備】 | |
1. forkする | |
githubのページから | |
2. fork元の変更を取り込めるようにremote add | |
git remote add upstream git://github.com:328w/XXXX.git |
This file contains 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
1. review/NAME/BRANCH_NAMEをレビューして下さいと依頼を受ける | |
2. ローカルのブランチへ取得 | |
git co -b review origin/review/NAME/BRANCH_NAME | |
3. 差分をチェック | |
(1) メールで指摘する | |
(2) 修正したよ!って言われた | |
git pull |
This file contains 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
1. 作業完了したブランチをレビュー用リモートブランチへ送る | |
git co BRANCH_NAME | |
git push origin BRANCH_NAME:review/NAME/BRANCH_NAME | |
※NAMEの部分はユーザ名 | |
2. レビューしてねと伝える | |
review/NAME/BRANCH_NAMEをレビューして下さいと伝える |
This file contains 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
1. initXXXメソッドは呼び出し側がrelease/autoreleaseする | |
2. 1以外のメソッドはメソッド側でautoreleaseした変数を返す | |
=> frameworkもこの原則を守っている | |
3. retain/copyした変数は、retain/copyした側が責任を持ってreleaseする | |
4. NSMutableArrayなどにaddObjectした変数はaddObject後にrelease可能 | |
=> autorelease済みならばreleaseしてはダメ | |
NewerOlder