UIImage *image = [UIImage imageNamed:[currentPhoto fileName]];
NSLog(@"%@",[currentPhoto fileName]);
[self.currentImage setImage:image];
它在调试区域中显示正确的映像名称
我想在UIImageView上显示。 currentImage已挂接到.h文件中的出口
是否由于iOS 6的新版自动布局功能而无法实现。
它曾经在iOS 5中运行。
我的目的是在特定场景的UIImageView中显示图像
我还尝试设置默认图像,该图像已复制到项目文件夹中。
但是我得到一个错误调试区域,如下所示:
Could not load the "myImage.png" image referenced from a nib in the bundle with identifier "com.xxx.xxx"
最佳答案
确保图像名称也带有扩展名(.jpg / .png)。您还为imageView定义了一个iBoutlet吗?
另外,如果问题在于自动布局,则可以在Xib中将其禁用。从这里学习。
http://www.goodbyehelicopter.com/2012/02/arggh-xcode-4-3-auto-layout-is-on-by-default-how-to-turn-off-auto-layout/