开发者

Triggering the UIViewController connected to the UITabBarItem

开发者 https://www.devze.com 2023-03-23 05:41 出处:网络
Good day to you guys I have an application that has a UITabBarController for tabbed-navigation... The view-controllers are mapped to their respective TabItems via a URL, just the same as that of Thre

Good day to you guys

I have an application that has a UITabBarController for tabbed-navigation... The view-controllers are mapped to their respective TabItems via a URL, just the same as that of Three20's TTNavigationSample App.

My problem is that inside a view controller of mine, i have a button that calls to another view controller which is also attached to a TabItem. When i trigger the button, the application throws an error. How can I resolve this?

In my TabBarController, i have this inside the viewDidLoad method:

-(void)viewDidLoad {
 [self setTabURLs: [NSArrayWithObjects:
                    @"tt://bulletinBoard",
开发者_运维问答                    @"tt://contacts",
                    nil
                   ]];
}


Sample .m file

#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
0

精彩评论

暂无评论...
验证码 换一张
取 消