2011-10-10 90 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