-1

アプリを iPhone 5 の Retina 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)];
    }
4

2 に答える 2

0

プログラムでコード内の iPhone デバイスのバージョンを確認し、それに応じてコントロールのサイズを変更する必要があります。

于 2013-05-03T10:40:40.723 に答える