views:

476

answers:

2

I have succesfully created a view hierarchy programmatically. I now want to replicate this hierarchy using Interface Builder (IB) instead.

In IB I have nested a UIView within the main Window. Do I now nolonger need the following in method applicationDidFinishLaunching:application:

[window addSubview:controller.view];
[window makeKeyAndVisible];

Notes: controller is a member of my UIApplicationDelegate subclass.

Thanks, Doug

A: 

No, you will not need to add it programmatically. If the view appears within the window in IB, it is automatically being added as a subview when the nib loads. In fact, you shouldn't even need to call [window makeKeyAndVisible] if your window is set up properly in IB.

e.James
Thanks eJames.
dugla
You are welcome :)
e.James
A: 

No, you shouldn't need addSubView here. Make sure that the correct nib file is loaded, that is the view associated with the Window for a window based app.

ennuikiller