2011-10-10 61 views
0

在我的应用程序委托接口我:标签栏视图不会加载

@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; 
} 

在我的主要厦门国际银行窗口,我有一个标签栏控制器,该控制器以rootController身份连接到应用程序委托。 当我运行该程序时,窗口显示,但标签栏视图不会被加载。 感谢任何帮助。谢谢。

回答

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]; 
+0

感谢您提供的解决方案。但我的问题是,我的标签栏项目视图控制器笔尖名称有扩展名。我取消了扩展名“xib”,现在一切都变成了魅力。 – saman01