日々精進

新しく学んだことを書き留めていきます

カテゴリにインスタンス変数は定義できない

以下のようなコードはコンパイルエラーになる。

@interface FlipLabel (CustomMethod)
@end

@implementation FlipLabel (CustomMethod){
    NSString *name;
}
@end

synthesizeも使えない。
>|objc|@interface FlipLabel (CustomMethod)
@property NSString *name;
@end

@implementation FlipLabel (CustomMethod)
@synthesize name = name_;
@end
|