gpt4 book ai didi

ios - 分发中缺少图像

转载 作者:行者123 更新时间:2023-11-28 22:28:20 25 4
gpt4 key购买 nike

我遇到了一个图像丢失的问题,但只有在为分发而构建时才会出现。此外,它只出现在 iPhone 5 上,而不会出现在 iPhone 4 或 4S 上。

This是在模拟器上为开发构建时的屏幕截图。

this是在实际 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];
}

buildBackgroundImage 在 init 函数中被调用。

最佳答案

我不是 100% 确定情况仍然如此,但我知道它曾经是:

iOS 模拟器对于外部文件名(例如您的图像)不区分大小写。因此,如果图像名为“myImage.png”并且您的程序要求“MyImage.png”,模拟器将正确找到并加载图像

但是,当您尝试在设备上运行它时,它 区分大小写,并且不会接受大小写错误的文件。

因此请仔细检查文件本身的大小写是否与您在程序中要求的一致。希望这会立即解决您的问题。

关于ios - 分发中缺少图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18262285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com