重新启动UIImage有可能吗?

时间:2013-10-01 07:05:10

标签: ios uiimage

我有点困惑。 我的视图控制器中有一个属性UIImage * myImage。在视图中我做了加载:

myImage = [UIImage imageWithName:@"white.png"];

当我在viewWillAppear中的另一个控制器接下来发生之后回到此控制器时:

myImage = [UIImage imageWithName:@"black.png"];

但是当我在视图控制器的imageview上显示图像时,图像不会改变。它还是白色的。 是否可以使用其他图像重新启动图像? 感谢您的关注!

2 个答案:

答案 0 :(得分:1)

imgView.image = [UIImage imageNamed:@"white"]];

 imgView.image = [UIImage imageNamed:@"black"]];

试试这个..

答案 1 :(得分:0)

 imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"white"]];

 imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"black"]];

应该是这样的

相关问题