我试图将"图像" 分配给"按钮" ,但由于理由"图像" 无法加载。
UIImage *bottonImage = [UIImage imageNamed:@"bocinaMute.png"];
[self.botton.imageView setImage:[UIImage imageNamed:@"mute.png"]];
当我在控制台中打印时,imageView
的值为:
po _botton.imageView
<UIImageView: 0x15f53a390; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x170235c20>>
我做错了什么?
答案 0 :(得分:5)
使用此:
[btnTwo setImage:[UIImage imageNamed:@"mute.png"] forState:UIControlStateNormal];
而不是
[self.botton.imageView setImage:[UIImage imageNamed:@"mute.png"]];