Why doesn't the default XCode Window based application template create the window programmatically?
I'm just starting out with objective c, iphone, and xcode dev. The default template has UIWindow *window as a member variable but I never see it initialized like:
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
which I'm confused as to why. Do we not need to do that b开发者_Python百科ecause the window is already creaqted in the nib file? Thank you very much everyone.
If you look at your app delegate's header file, just beneath the @interface
part, you see this:
@property (nonatomic, retain) IBOutlet UIWindow *window;
This connects the window
property to the window object in your nib file, so it's already created within the nib file and there's no need to allocate a new UIWindow
object. Your app delegate simply looks in the nib file and uses the object in there.
精彩评论