0

イメージが欠落しているという問題がありますが、配布用にビルドした場合のみです。また、iPhone 5 でのみ発生し、iPhone 4 または 4S では発生しません。

これは、シミュレーターで開発用にビルドしたときのスクリーンショットです。

これは実際の iPhone 5 で配布用にビルドしたときのスクリーンショットです

開発と配布の両方に単一のターゲットがあります。関連コード:

int deviceNumber = 4;
        if([UIScreen mainScreen].bounds.size.height > 500)
            deviceNumber = 5;

MYIntroductionView *introductionView = [[MYIntroductionView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height) panels:@[panel1,panel2,panel3]];

if(deviceNumber == 4){
            [introductionView setBackgroundImage:[UIImage imageNamed:@"One Degree_Iphone4_Background.png"]];
        }
        else{
            [introductionView setBackgroundImage:[UIImage imageNamed:@"One Degree_Iphone5_Background.png"]];
        }

MyIntroductionView.m 内の関連コードは次のとおりです。

-(void)setBackgroundImage:(UIImage *)backgroundImage{
    self.BackgroundImageView.image = backgroundImage;
}

-(void)buildBackgroundImage{
    self.BackgroundImageView = [[UIImageView alloc] initWithFrame:self.frame];
    self.BackgroundImageView.backgroundColor = [UIColor clearColor];
    self.BackgroundImageView.contentMode = UIViewContentModeScaleToFill;
    self.BackgroundImageView.autoresizesSubviews = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    [self addSubview:self.BackgroundImageView];
}

buildBackgroundImageinit 関数内で呼び出されます。

4

1 に答える 1

2

これが今でも当てはまるかどうかは 100% 確信が持てませんが、以前は次のようだったことはわかっています。

iOS シミュレーターは、外部ファイル名 (画像など) に関して大文字と小文字を区別しません。したがって、画像の名前が「myImage.png」で、プログラムが「MyImage.png」を要求した場合、シミュレーターは画像を正しく見つけてロードします

ただし、デバイスで実行しようとすると、大文字と小文字が区別され、大文字と小文字が正しくないファイルは受け入れられません。

したがって、ファイル自体の大文字と小文字がプログラムで求めているものと同じであることを再確認してください。うまくいけば、それで問題が解決します。

于 2013-08-15T22:09:43.350 に答える