Domanda

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?

È stato utile?

Soluzione

Use this:

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

instead of

[self.botton.imageView setImage:[UIImage imageNamed:@"mute.png"]];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top