UIImageView 不更新我的图像
我正在尝试设置我的图像:
detailedEventViewController.thumbnail.image = [UIImage imageNamed:@"amnesia.png"];
但图像视图显示为空白。 amnesia.png 在我的资源组中。该文件存在。
我的日志结果:
2011-01-08 10:52:32.822 HD Pocket Vacations[25271:207] Image: <UIImage: 0x66203b0>
2011-01-08 10:52:32.823 HD Pocket Vacations[25271:207] dEVC: <DetailedEventViewController: 0x6628340>
2011-01-08 10:52:32.824 HD Pocket Vacations[25271:207] thumbnail: (null)
I am trying to set my image:
detailedEventViewController.thumbnail.image = [UIImage imageNamed:@"amnesia.png"];
But the imageview appears blank. amnesia.png is in my resources group. The file exists.
Results of my log:
2011-01-08 10:52:32.822 HD Pocket Vacations[25271:207] Image: <UIImage: 0x66203b0>
2011-01-08 10:52:32.823 HD Pocket Vacations[25271:207] dEVC: <DetailedEventViewController: 0x6628340>
2011-01-08 10:52:32.824 HD Pocket Vacations[25271:207] thumbnail: (null)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否将
thumbnail
属性链接到 IB 中的UIImageView
?尝试通过将行更改为: 来获取更多信息,
并告诉您在调试器控制台窗口中看到的内容。
Did you link up the
thumbnail
property to aUIImageView
in IB?Try to get a little more information by changing the line to:
and tell what you see in the debugger console window.
根据您提供的日志进行操作。你什么时候尝试设置这个?如果您尝试在 init 方法中执行此操作,那么它还没有绑定到 Nib,并且为什么它是 Null。
在 viewDidLoad: 方法中执行此操作,它应该已连接。
Following on from the logs you provided. When are you attempting to set this? If you are trying to do this in your init method it won't have bound to the Nib yet and why it is Null.
Do this in the
viewDidLoad:
method and it should have hooked up.