【发布时间】:2012-04-10 13:46:22
【问题描述】:
我正在开发一个 iPhone 应用程序,但遇到了障碍。
NSString *fileLocation = [[NSBundle mainBundle] pathForResource:@"happy.1" ofType:@"jpg"];
UIImage *new_image = [UIImage imageWithContentsOfFile:fileLocation];
[self setImage:new_image];
if (new_image == nil) {
NSLog(@"can't load image happy.1.jpg");
}
bgImageView.image = image;
这是我用来显示图像的代码,但它没有出现! new_image 不是零,我知道如果它无法加载图像会是这样。 bgImageView 是一个 IBOutlet 并在 IB 中连接。
请告诉我我做错了什么。谢谢!
编辑:另外,这在模拟器和设备上都不起作用
【问题讨论】:
标签: iphone uiimageview