MKMapView inside Tab Bar and Navigtion Controller hides Google branding
I just received the following message when submitting to the app store:
In addition, the application displays images provided by Google Maps without the corresponding Google branding, we cannot post this version to the App Store
I have a 开发者_Go百科TabBar with a NavigationController inside. The Navigation Controller loads the map in
- (void)viewDidLoad {
[super viewDidLoad];
mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
// ...
}
This works, but the mapView ends below the tab bar, so the Google logo is not shown. To get the frame correctly I have to create it manually
- (void)viewDidLoad {
[super viewDidLoad];
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0,0,320,370)];
// ...
}
This works, but doesn't feel right. What is the right way to do it?
The main interface (TabBar + Navigation Controllers) is created in Interface Builder.
This fixes the issue
mapView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
Thats fine. :p Similarly you could do:
- (void)viewDidLoad {
[super viewDidLoad];
CGRect bounds = self.view.bounds;
bounds.size.height -= 90; // i think the tab bar controller is 90
mapView = [[MKMapView alloc] initWithFrame:bounds];
// ...
}
Another way would be by
CGRect viewBounds = self.view.bounds;
viewBounds.size.height -= self.tabBarController.tabBar.frame.size.height + self.navigationController.navigationBar.frame.size.height;
This way you dont supply absolute numerical values.
精彩评论