I'm trying to make a multiview application. I started by creating an 'empty application' as I thought this would be easiest. I have 3 .xib files, the first being MainView.xib which has a view controller which is linked to my switch class, and has a tool bar to switch between the two views, and I have selected this .xib to be 'main interface' which I thought meant that should be loaded first. My other blue are RedView.xib and BlueView.xib.
I've heard this method in AppDelegate.m can cause some problems, here is mine...
- (void)applicationDidFinishLaunching:(UIApplication *)application {
//add SwitchClasses view to the main window
[window addSubview:switchObject.view];
[window makeKeyAndVisible];
}
I don't know whether I have missed something because I started with an empty application, or if I've messed something up along the way.
Thank you for your help.
做这个:
window.rootViewController = switchObject;
First make sure that you have given reference from XIB view to the ViewController for both the Views you are using in TabBar. then try the following.
switchObject = [[[switchObject alloc] initWithNibName:@"switchObjectXib" bundle:nil] autorelease];
window.rootViewController = switchObject;
[window makeKeyAndVisible];
hope this will help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.