I have a tab app, and the first tab has MKMapView . What I want to do is somewhere else in the application, switch the active tab to mapview and set the display area based on the data in the previous view (the one in which the button switches to display).
I tried:
[self.tabBarController setSelectedView:0]; UIMapViewController *mapView = [self.tabBarController.viewControllers objectAtIndex:0]; [mapView displayBookmarkAnnotation:bookmark];
It just crashes the application, which cannot find the method I created. I do not think that I have chosen the best way to implement this, but I am really not sure how I should do it.
[Update] Casting the controller returned by tabBarController had no effect.
[solvable] I'm trying to use a UINavigationController for my mapView
[self.tabBarController setSelectedView:0]; UINavigationController *navController = [self.tabBarController.viewControllers objectAtIndex:0];
source share