I have strange behavior in my app. In My app i am using below code get images from resource folder..working fine at starting but if i test my app continuously one hour after that i am not getting any images from resource folder then in my all view coming without back ground image...
我的应用程序中有奇怪的行为。在我的应用程序中,我正在使用下面的代码从资源文件夹中获取图像。工作正常,但如果我在一小时后连续测试我的应用程序,我没有从资源文件夹中获取任何图像,然后在我的所有视图中没有背景图像。 ..
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"box_s3_landscape" ofType:@"png"]]
2 个解决方案
#1
1
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"box_s3_landscape" ofType:@"png"]]
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@“box_s3_landscape”ofType:@“png”]]
This line of code does not caches your Image.
这行代码不会缓存您的Image。
try using [UIImage imageNamed@""];
尝试使用[UIImage imageNamed @“”];
#2
0
Are you running this in Simulator? The Resources/iphone directory should work fine. This is a simulator-only issue, which has been resolved for 1.8.0
你在模拟器中运行吗? Resources / iphone目录应该可以正常工作。这是仅限模拟器的问题,已针对1.8.0进行了解决
#1
1
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"box_s3_landscape" ofType:@"png"]]
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@“box_s3_landscape”ofType:@“png”]]
This line of code does not caches your Image.
这行代码不会缓存您的Image。
try using [UIImage imageNamed@""];
尝试使用[UIImage imageNamed @“”];
#2
0
Are you running this in Simulator? The Resources/iphone directory should work fine. This is a simulator-only issue, which has been resolved for 1.8.0
你在模拟器中运行吗? Resources / iphone目录应该可以正常工作。这是仅限模拟器的问题,已针对1.8.0进行了解决