我正在尝试使我的应用程序适应 iPhone 5 的视网膜 4 屏幕,并添加 png 存档和所有内容都调整大小,但地图视图会移动到顶部并在底部留下一个白色方块。我想知道如何解决它。
提前致谢。
也许这与它有关?
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// We need to manually handle rotation on iPads running iOS 5 and higher to support the new UINavigationBar customization. This is automatic on the iPhone & iPod Touch.
if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"UINavBarLandscape@iPad.png"] forBarMetrics:UIBarMetricsDefault];
}
else {
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"UINavBar@iPad.png"] forBarMetrics:UIBarMetricsDefault];
}
}
}
else {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
[mapView setFrame:CGRectMake(0, 0, 480, 236)];
[toolbar setFrame:CGRectMake(0, 236, 480, 32)];
}
else {
[mapView setFrame:CGRectMake(0, 0, 320, 372)];
[toolbar setFrame:CGRectMake(0, 372, 320, 44)];
}