Reputation: 1
I'm a first time programmer and i'm trying to make a soundboard app. Its not finished yet and it is pretty basic. I have a main menu with one button. When this button is pressed, a different background image should appear along with a back button. The image does not change. here is the code:
-(IBAction)redgradient {
UIImage *img = [UIImage imageNamed:@"redgradient.jpg"];
[imageView setImage:img];
}
-(IBAction)redgradient2 {
UIImage *img = [UIImage imageNamed:@"redgradient2.png"];
[imageView setImage:img];
}
I have mentioned the IBActions in the H file and used an IBOutlet of ImageView. Help is appreciated.
Upvotes: 0
Views: 1229
Reputation: 826
Here's a more simple way to do that, test if this works better:
-(IBAction)redgradient {
imageView.image = [UIImage imageNamed:@"redgradient.jpg"];
}
-(IBAction)redgradient2 {
imageView.image = [UIImage imageNamed:@"redgradient2.png"];
}
Check if the images ends on .jpg or .png if that is the problem.
Upvotes: 2
Reputation: 48398
Here are a few things to check:
Upvotes: 0