u16suzuの blog

日々学んだことのメモブログです。

2013-10-01から1ヶ月間の記事一覧

カスタムイニシャライザMemo

- (id)initWithDict:(NSDictionary *)dict { self = [super init]; if (self) { self.content = dict[@"content"]; self.name = dict[@"name"]; } return self; }

NSErrorを出力する方法

localizedDescription method の名前をいつも忘れるのでメモ NSString *message = [error localizedDescription]; NSLog(@"plist delete Faild. message:%@",massage);

Protocolのスパイク

// SNSPost.h #import "CustomModel.h" @protocol hogeDelegate <NSObject> @required - (void)fuga; @end @interface SNSPost : CustomModel @property (nonatomic, weak) id <hogeDelegate>delegate; - (void)hoge; @end // SNSPost.m #import "SNSPost.h" @implementation SNSPost</hogedelegate></nsobject>…

typedef with enum

typedef NS_ENUM(NSInteger, HogeState) { HogeStateStart, HogeStatePause, HogeStateEnd };

KVO

あるオブジェクトのプロパティが変更されたことを検知できる. 非同期でネットからデータ持ってきてうんぬんかんぬんするときに便利. static char LoadTwitterIconUrlKVONotification_Dictionary; -(void)updateIconURL{ // KVO登録 [self addObserver:self f…