문제

I'm trying to assign an "Image" to "Button", but for reason the "Image" doesn't load.

    UIImage *bottonImage = [UIImage imageNamed:@"bocinaMute.png"];

    [self.botton.imageView setImage:[UIImage imageNamed:@"mute.png"]];

When I print it in the console the value of the imageView is:

po _botton.imageView
<UIImageView: 0x15f53a390; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x170235c20>>

What am I doing wrong?

도움이 되었습니까?

해결책

Use this:

[btnTwo setImage:[UIImage imageNamed:@"mute.png"] forState:UIControlStateNormal];

instead of

[self.botton.imageView setImage:[UIImage imageNamed:@"mute.png"]];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top