Home > Blockchain >  Xcode - Autolayout and image changing size
Xcode - Autolayout and image changing size

Time:02-25

I have an application with a screen with image of a person which has auto layout constraints applied to it.

When I navigate to and from this screen, the size of that image is always changing when I inspect it but to look at it doesn't change size at all. The image shows where I have included print statements in the code to show the figure changing.

I cannot figure out why this is happening - I need to know the size of that figure at run time as other images are sized according to this size.

I really appreciate any help - this has been driving me insane for 2 days now! Let me know if there are any particular parts of code/storyboard that it would be useful to see.

Image showing print statements of changing size

CodePudding user response:

Solved it!

I found that when loading the view it wasn't actually updating to be the size of the screen before I took the measurements.

Instead of taking the measurements in viewDidLoad() I used the viewDidAppear()

  • Related