I have a problem understanding how the auto layout works. I have the following structure in my controller scene:
View
ScrollView
View
Image View
Constraints
SuperView.Bottom = View.Buttom
SuperView.Trailing = View.Trailing
View.Leading = SuperView.Leading
View.Top = SuperView.Top
Constraints
ScrollView.Top = SuperView.TopMargin
SuperView.TrailingMargin = ScrollView.Trailing (-16)
ScrollView.Leading = SuperView.Leading (-16)
BottomLayoutGuide.Top = ScrollView.Bottom (-40)
This handles the scrollview that I need. There are other contents in the view but I "uninstalled" them for now to make the Image View Work first. I want to make the ImageView to have width based on the screen size (iPhone 5 will have 320px, iPhone 6+ will have 1080px). So, I tried to add constraints to the ImageView (View.Trailing = SuperView.Trailing; View.Leading = SuperView.Leading; AspectRatio - 2:1) but it just keeps making the image size bigger extremely huge that, it doesn't even fit the screen. If I put height constraints, it works, but I don't want to put height constraints as I want the size to not be dependent of a constant width/height.
What am I doing wrong? I don't quiet understand AutoLayout; I understand the basic concept of AutoLayout but when it comes to implementation, I have no idea what to do... :/