drw
drw

Reputation: 943

UIImageView defined in IB has zero size?

A very short question. Created a UIImageView in IB with is a IBOutlet in its view controller. However, when it look for its its size with .frame.size everything seems to be null. It would be nice to be able to set the dimensions in IB and have the code pick up and respond to it. Is there something I am doing wrong here?

Upvotes: 1

Views: 326

Answers (2)

rekle
rekle

Reputation: 2375

Make sure you connect your UIImageView to it's IBOutlet in IB.

Also, the connections with the outlets aren't actually done until viewDidLoad, so you would still see nil if you tried to access the imageview before this method is called.

Upvotes: 0

Max
Max

Reputation: 16709

I'm almost certain that you haven't connected your IBOutlet with appropriate view in IB.

Upvotes: 1

Related Questions