Environment: xcode4.0, Interface Builder
Objective: I think there is not MainWindow.xib create UITabBarController, change in another xib in
Steps:
1 Create a pure Window Based Project
2 In xxxAppDelegate.h in to add a viewcontroller attribute (MainWindow.xib things I did not modify)
3 Add a customTab.xib
4 Specify customTab.xib the File's Owner to xxxAppDelegate
5 In customTab.xib, from the library dragged out a Tab Bar Controller
6 In customTab.xib, from the library dragged out an Object, custom class point xxxAppDelegate
7 related to the Tab Bar Controller Object (ie xxxAppDelegate) of viewcontroller
Start the project, I found UITabBar totally did not show up. What steps do I wrong
Reply:
Upgrade xcode it, now using a storyboard
Reply:
Because the default window.rootViewController still pointing viewController properties. You set those useless.
The only way not just to achieve through the nib file, you can use code to write
NSMutableArray * controllers = [NSMutableArray array];
FirstViewController * firstVC = [[FirstViewController alloc] init];
[Controllers addObject: firstVC];
[FirstVC release];
SecondViewController * secondVC = [[SecondViewController alloc] init];
[Controllers addObject: secondVC];
[SecondVC release];
.......
/ / Create the UITabBarController
UITabBarController * tabBarController = [[UITabBarController alloc] init];
[TabBarController setViewControllers: controllers];
self.window.rootViewController = tabBarController;
[TabBarController release];
Reply:
You can try a storyboard
Reply:
I google for quite a while, and finally found really can not be displayed directly through the IB / start a non MainWindows.xib of UITabBarController, I have concluded on
http://www.cocoachina.com/bbs/read.php?tid=125671 it.
No comments:
Post a Comment