在我的app delegate界面中,我有:
@interface pivcalc1AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
IBOutlet UITabBarController *RootController;
}
@property (nonatomic, retain) IBOutlet UIWindow *Window;
@property (nonatomic, retain) IBOutlet UITabBarController *RootController;
在实施中,我有:
@synthesize Window;
@synthesize RootController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
[Window addSubview:RootController.view];
// Override point for customization after application launch.
[self.Window makeKeyAndVisible];
return YES;
}
在我的主xib窗口中,我有一个标签栏控制器,它作为rootController连接到app delegate。 当我运行程序时,窗口显示但是标签栏视图没有加载。 感谢任何帮助。感谢。
答案 0 :(得分:0)
你在xib的RootController中有一个subViewController吗?如果你不是,那就是代码。
UITabBarController应该有一个subViewController。
UINavigationController *localNavigationController;
NSMutableArray *localViewControllerArray = [[NSMutableArray alloc] initWithCapacity:2];
SubViewController *subviewController0 = [[SubViewController alloc] init];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:subviewController0];
[localViewControllerArray addObject:localNavigationController];
[subviewController0 release];
[localNavigationController release];
SubViewController *subviewController1 = [[SubViewController alloc] init];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:subviewController1];
[localViewControllerArray addObject:localNavigationController];
[subviewController1 release];
[localNavigationController release];
RootController.viewControllers = localViewControllerArray;
[localViewControllerArray release];
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];