Reputation: 12431
Still a newbie here, forgive me. I'm trying to make a button that will change an Image thats located in the same view.
- (IBAction)myButton:(id)sender {
myUIImageView.image = [UIImage imageNamed:@"image.jpg"];
}
And I synthesize myUIImageView above this. I have also created it in the .h file:
- (IBAction)myButton;
@property(retain, nonatomic) IBOutlet UIImageView* myUIImageView;
I have created a button called myButton in IB. Connected it's Touch Up Inside event to File's Owner. I've connected to the UIImageView with File's Owner. Also, I have image.jpg inside my resources folder, however the image stays the same when I push the button. Nothing happens! The app loads fine with no errors, any advice would help,
Thanks!
Upvotes: 0
Views: 151
Reputation: 8488
Put an NSLog statement inside of your IBAction to make sure that you have properly connected to the action. Also make sure that you have the same signature for your IBAction in your header file and implementation file. Right now one of them is
- (IBAction)myButton;
and the other is
- (IBAction)myButton:(id)sender
Make sure that they both have the same signature.
Upvotes: 1