I have a Google Map View in a view controller inside of a navigation controller that is on a tabbar controller. Everything works as it should but the load times on the map range from 5-10 seconds when I initially tap on the Map tab.
I've come across several StackOverflow posts which list the following method of preloading a tab:
for (UIViewController *viewController in self.tabBarController.viewControllers)
{
[viewController view];
}
I've modified it to my particular implementation.
for (UIViewController *viewController in self.tabBarController.viewControllers)
{
UINavigationController *navCon = (UINavigationController*)viewController;
for (UIViewController *vc in navCon.viewControllers) {
if ([[NSString stringWithFormat:@"%@",vc.class] isEqual: @"MapViewController"]){
MapViewController *mv = (MapViewController*) vc;
[mv view];
}
}
}
Unfortunately, neither implementation preloads the map tab.
Specs
- Google Maps SKD 1.7.2
- iOS SDK 7.1
Edit ViewDidLoad on the MapViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
mapView_ = [GMSMapView mapWithFrame:self.view.bounds camera:nil];
mapView_.delegate = self;
AppDelegate *appDelegate=(AppDelegate *)[UIApplication sharedApplication].delegate;
CLLocationCoordinate2D loc=appDelegate.locationManager.location.coordinate;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:loc.latitude
longitude:loc.longitude
zoom:12];
[mapView_ setCamera:camera];
mapView_.myLocationEnabled=YES;
mapView_.settings.myLocationButton = YES;
self.view = mapView_;
}