2011-07-28 64 views
0

好一天的UIViewController給你們觸發連接到UITabBarItem

我有了標籤式導航一個的UITabBarController的應用...視圖控制器通過一個URL映射到它們各自的TabItems,只是與Three20的TTNavigationSample App相同。

我的問題是,在我的視圖控制器內,我有一個按鈕,調用另一個視圖控制器,它也附加到一個TabItem。當我觸發按鈕時,應用程序會引發錯誤。我該如何解決這個問題?

在我的TabBarController,我有這個viewDidLoad方法中:

-(void)viewDidLoad { 
[self setTabURLs: [NSArrayWithObjects: 
        @"tt://bulletinBoard", 
        @"tt://contacts", 
        nil 
        ]]; 
} 
+0

你得到了什麼錯誤?通常情況下,你正在嘗試的場景是... – tipycalFlow

回答

0

樣品.m文件

#import "HabBarController.h" 


@implementation TabBarController 


- (void)viewDidLoad { 

    //these are variables like "tt/feed" 
    [self setTabURLs:[NSArray arrayWithObjects: 
         kAppFeedURLPath, 
         kAppHotURLPath, 
         kAppPostPhotoURLPath, 
         kAppGeneralActivityURLPath, 
         nil]]; 


} 

- (UIViewController*)rootControllerForController: 
(UIViewController*)controller { 

    if ([controller canContainControllers]) { 

     return controller; 
    } else { 
     UINavigationController* navController = [[[UINavigationController 
                alloc] init] autorelease]; 
     [navController pushViewController:controller animated:NO]; 
     return navController; 
    } 
} 


- (void)viewWillDisappear:(BOOL)animated { 
    [super viewWillDisappear:animated]; 
    [self.tabBarController.navigationController setNavigationBarHidden:YES animated:NO]; 

} 
- (void)didReceiveMemoryWarning { 

    [super didReceiveMemoryWarning]; 


} 

- (void)viewDidUnload { 
    [super viewDidUnload]; 
} 


- (void)dealloc { 
    [super dealloc]; 
} 

@end