iOS背景图像不';不要在设备上工作
这是我的问题: 我将此添加到我的代码中:iOS背景图像不';不要在设备上工作,ios,image,background,device,Ios,Image,Background,Device,这是我的问题: 我将此添加到我的代码中: [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bgWhiteLight"]]]; 它在iOS模拟器中运行良好,但当我在真实设备上测试它时,它根本不工作。请注意,我重新定义了 self.navigationItem.titleView 但在模拟器中根本没有pb,只有在真实设备上 谢谢在设备上,名称区分大小写。 确保它的名字准确无误 设
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bgWhiteLight"]]];
它在iOS模拟器中运行良好,但当我在真实设备上测试它时,它根本不工作。请注意,我重新定义了
self.navigationItem.titleView
但在模拟器中根本没有pb,只有在真实设备上
谢谢在设备上,名称区分大小写。
确保它的名字准确无误 设备上的名称区分大小写。
确保它的名字准确无误 有时仅指定文件名是不够的,您可以这样做
NSString *path = [[NSBundle mainBundle] pathForResource:@"bgWhiteLight" ofType:@"jpg"];
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[[UIImage alloc] initWithContentsOfFile:path]];
有时仅仅指定文件名是不够的,您可以这样做
NSString *path = [[NSBundle mainBundle] pathForResource:@"bgWhiteLight" ofType:@"jpg"];
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[[UIImage alloc] initWithContentsOfFile:path]];
试试这个。给出图像的全名
试试这个。给出图片的全名你能不能用真名比如
bgWhiteLight.png
而不是bgWhiteLight
?你能不能用真名比如bgWhiteLight.png
而不是bgWhiteLight
?