0

アプリに問題があります。UIImageView "Default-Landscape.png" でスプラッシュを取得しました。コードは次のとおりです。

- (void)showLoadingWithTitle:(NSString*)loadingTitle {
    if(![self.view viewWithTag:123456]) {
        UIImageView *overlayView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
        //overlayView.backgroundColor = [UIColor lightGrayColor];
        overlayView.tag = 123456;
        overlayView.autoresizingMask = UIViewAutoresizingFlexibleWidth+UIViewAutoresizingFlexibleHeight;
        overlayView.image = [UIImage imageNamed:@"Default-Landscape.png"];
    }
}

ここまでは順調ですね。iPad を縦向きに回転すると問題が発生します。Portait は横向きの画像を読み込んでいると思います。どうすればよいかわかりません。何かアイデアはありますか?

4

1 に答える 1

0

編集:実際にはもっと簡単に...

  - (void)showLoadingWithTitle:(NSString*)loadingTitle {
    if(![self.view viewWithTag:123456]) {
        UIImageView *overlayView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
        //overlayView.backgroundColor = [UIColor lightGrayColor];
        overlayView.tag = 123456;
        overlayView.autoresizingMask = UIViewAutoresizingFlexibleWidth+UIViewAutoresizingFlexibleHeight;
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) || 
            ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) 
         {
        overlayView.image = [UIImage imageNamed:@"Default-Landscape.png"];
         } else
{
        overlayView.image = [UIImage imageNamed:@"Default-Portrait.png"];

}
    }
}
于 2012-04-18T21:16:57.993 に答える