I am new to iPhone development.
I have been looking at samples and made a sample project, but am stuck.
I am trying to add a view to the AppDelegate class so it will show when the app is launched.
code is as follows
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
However this does not show the .xib tied to the viewController but the MainWindow.xib is shown.
I think it is being added since when I shut the app down the content of the desired view
is shown as it is shutting down.
I thought the addSubview puts the view in front of all others when called.
Is there something I should do in the Interface Builder to set priorities?
Updated:
By lowering the alpha attribute to 0.0 for the UIWindow for MainWindow.xib made the
view that was added by addSubview apear. However this is prob not the right thing to do.
Ok I found out what was wrong, it was a really careless mistake I made when I was using the Interface Builder.
I mistakenly created the xib to add to the MainWindow.xib as a window.xib and not a view.xib.
Once recreating it as a view.xib everything went fine.
…so embarrassed I have made such a stupid mistake, hope it would be useful to others.