iphone - Not be able to change image of UIButton -


I want to set the image of the button on viewWillAppear.

I have tried to follow all the code -

  UIButton * front; UIImage * temp = [UIImage imageNamed: @ "06_asystole.jpg"]; [Front setbackground image: State for temporary: UIControlStateNormal]; //front.imageView.image = [UIImage imageNamed: @ "06_asystole.jpg"]; /// [Front setbackground image: [UIImage imageNamed: @ "06_asystole.jpg" forState: UIControlStateNormal]]; // [Set image in front: [UIImage imageNamed: @ "06_asystole.jpg" forState: UIControlStateNormal]];   

I have also set the IBolet in the button and specified it in the XIB.

I do not know how the button image can not be set.

Thank you ..

This will not work :

  UIButton * front = [[UIButton alloc] init]; UIImage * temp = [UIImage imageNamed: @ "06_asystole.jpg"]; [Front setbackground image: State for temporary: UIControlStateNormal];   

You want to change the existing UIButton to backgroundImage . Either you can add front to your view and remove the old or use the existing button name instead of front .

Comments