iOS Xcode 4 properties access

I switched to Xcode 4 recently and I don't really understand this new way to write accessors. For example, in the application delegate class that is auto-generated when creating a new project, the window object is not declared in the @interface but just this way:

@property (nonatomic, retain) IBOutlet UIWindow *window;

Then, in the implementation file, we have the @synthesize window=_window;. А в функциях у нас либо self.window ИЛИ _window .

Например:

[self.window makeKeyAndVisible]; // in didFinishLaunchingWithOptions function
[_window release]; // in dealloc function

Вы можете объяснить мне разницу, почему в ничего нет ] @interface , почему мы делаем @synthesize window = _window; вместо @synthesize window; и в чем разница между self.window и _window , я имею в виду, когда мне нужно вызывать одного чаще, чем другого?

Я немного потерялся и чувствую, что новый код, который я пытаюсь сделать то же самое, не работает должным образом. ..

Спасибо!

5
задан Dachmt 25 May 2011 в 20:32
поделиться