pekpon
pekpon

Reputation: 769

UIImageView fit to View frame size

When I create a new ViewController and I drag a UIImageView to this, the UIIV grows to fit fullscreen with the width and height from the screen. If I change between 4 and 3,5" screen, the UIImageView changes his height dynamically.

enter image description here

BUT, when I try to insert an UIImageView to a view with more elements, this UIImageView is setted with 4:3 ratio size, and if I try to resize this to fullscreen, when I change between screen sizes, a part of the imageView is hidden.

enter image description here

How can I fix it?

Upvotes: 0

Views: 342

Answers (1)

oldman
oldman

Reputation: 4316

Short Answer: use Auto layout


Long Answer:

  1. select imageview, add left, right, top, bottom constraints (all equal to 0) to tableview
  2. select imageview, update frames

step 1


step 2

Upvotes: 1

Related Questions