Skip to content

Instantly share code, notes, and snippets.

@yukinaga
Created February 8, 2014 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukinaga/8880259 to your computer and use it in GitHub Desktop.
Save yukinaga/8880259 to your computer and use it in GitHub Desktop.
Objective-Cでは、インスタンス変数をどこに宣言するのが正しいのか? ref: http://qiita.com/yuky_az/items/f2c3db2796d0a73dfde2
インスタンス変数は実装詳細であり、通常、クラス自身の外からアクセスされることはあり
ません。さらに、実装ブロック内に宣言すること、あるいは宣言済みプロパティから自動生
成させることも可能です。したがって通常は、インスタンス変数宣言をパブリックインター
フェイスで行うべきではないので、波括弧も省略してください。
@implementation ViewController{
IBOutlet UILabel *label;
}
@interface SampleClass : NSObject{
IBOutlet UILabel *label;
}
@interface ViewController (){
IBOutlet UILabel *label;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment