thephatp
thephatp

Reputation: 1489

UIViewController - Can't change image within vcontroller.view via IBOutlet

Ok, I used a work-around for something similar to this last night...but a workaround won't suffice for my new situation, so I figured I should find out what I'm missing.

I have a UIViewController that has a main UIView item, and 2 UIButton objects and a UIImageView. I have the File's Owner set to my view controller class. The ViewController has a class variable "IBOutlet UIImageView * backgroundImage". I have set the outlet in Interface Builder such that the UIImageView references the "backgroundImage" property.

I would assume at this point that I should be able to change the UIImageView item. However, this is not the case. I can set it in code, and my app does NOT blow up (due to a lack of outlet setting or anything), but the image simply doesn't change. I was trying something VERY similar to this last night where I had a UIView within the root UIView item of the ViewController and I was trying to reference that to a class variable to specifically control that view. However, that never worked either.

How can I control (via IB and outlets) the subview items of a UIViewController.view?

Just to be explicit, here is my setup:

UINavigationController --> UITableViewController (tvc)

From the "tvc", push a new UIViewController (vc, notice this isn't a table). <-- This is what I'm describing above

In the "vc" (UIViewController):

Upvotes: 0

Views: 296

Answers (1)

cdasher
cdasher

Reputation: 3073

Are you setting the actual image for the UIImageView like

backgroundImage.image = [UIImage imageNamed:@"myImage.png"];  
//(Where myImage.png has been added to to your project)

Upvotes: 0

Related Questions