Hi all, I have a window based iPhone application with multiple tabs and a navigation bar controller which appears on all these tabs. It's a weather/climate app, so I want the user to first choose a city, then be presented with weather info in each tab for that city (they can go back to the city select from any tab using the navigation bar. I followed this guide: http://www.youtube.com/watch?v=LBnPfAtswgw but added more tabs with the same settings. So I get the current tab and instantiate the app delegate like this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger currTab;
AppDelegate_iPhone *delegate = [[UIApplication sharedApplication] delegate];
currTab = delegate.rootTabController.selectedIndex;
...
That works fine, returns correct selected tab when called in viewDidAppear. Then my code for pushing to the corresponding view (in this case, UIForecastViewController) like so:
if (currTab == 0) {
if (self.forecastViewController == nil) {
UIForecastViewController *chosenCity = [[UIForecastViewController alloc] initWithNibName:@"UIForecastViewController" bundle:nil];
// note forecastViewController is a variable, not the class
self.forecastViewController = chosenCity;
[chosenCity release];
}
forecastViewController.title = [NSString stringWithFormat:@"%@ Forecast",[cityArray objectAtIndex:row]];
[delegate.navController pushViewController:forecastViewController animated:YES];
}
Everything else works as it should, but the pushViewController does nothing. I've searched fruitlessly for a solution, there are slightly similar examples out there but none using the app delegate or giving me any results. Hopefully I've mentioned everything I should have, any help/advice will be much appreciated! Regards.