2010-07-05

プロパティの宣言

■@property は、クラスにアクセッサメソッドを付加する。

インスタンス変数が NSString* test; の場合
@property (nonatomic, retain) NSString* test;

■@synthesize は、アクセッサメソッドを自動的に「合成」する。

プロパティ名とインスタンス変数名が同名の場合
@synthesize test;

プロパティ名とインスタンス変数名が別名(NSString* _test)の場合
@synthesize test = _test;

No comments:

Post a Comment