I have a UIViewController that has two properties: a UIImageView and a UiButton. They are both IBOutlets properly connected on the Interface Builder. My problem is that when i instantiate this view and set both properties only the UIImageView is set. My UIButton is a custom button and I’m trying to assign an UIImage to it. This is my code:
MyViewController *viewController = [[MyViewController alloc]initWithNibName:@"MyViewController" bundle:nil];
[viewController view];
viewController.myImageView.image = [UIImage imageNamed:@"image1.png"];
viewController.myButton.imageView.image = [UIImage imageNamed:@"image2.png"];
any idea on what I’m doing wrong?
replace
with
should work