Hi,
I have a UITabbarController set by the Interfacebuilder. The tabbarcontroller has 5 tabs, the first is a welcome page, and the second is a UITableViewController. Both have a NavigationController. The 2nd tab should show a category list. When I launch the app, all is fine. When I press the 2nd tab, it load the view perfectly with the navigation controller. But what I want to do is to be able to load a certain category in the 2nd tab using a link in the first tab.
So what I did was I added the following function in my appDelegate and call is from the view in my first tab:
- (void)loadCategoryViewUsingCategoryId:(NSString*)categoryId
{
CategoryViewController *categoryView = [[CategoryViewController alloc] initWithLoadingCategoryUsingCategoryId:categoryId];
if (!categoryView) {
UIAlertView *errorView;
errorView = [[UIAlertView alloc]
initWithTitle: NSLocalizedString(@"Whoops", @"oddsAppAppDelegate")
message: NSLocalizedString(@"I did not found the requested category. Sorry!", @"oddsAppAppDelegate")
delegate: self
cancelButtonTitle: NSLocalizedString(@"Close", @"oddsAppAppDelegate") otherButtonTitles: nil];
[errorView show];
[errorView autorelease];
}
else {
self.tabBarController.selectedIndex = 1;
self.tabBarController.selectedViewController = categoryView;
[self.tabBarController.selectedViewController setTitle:@"apa"];
[self.tabBarController.selectedViewController viewDidLoad];
}
}
This works perfectly, BUT... when the 2nd tab is loaded it doesn't have the navigation controller toolbar. How can I load it so I keep my navigation controller toolbar?
The "CategoryViewController
" is a UITableViewController
by the way.
Best regards,
Paul Peelen