Reputation: 137
Size class is same and constraint is also same, but getting different height green box. Does constant should work same for same size classes ?
If not then how i will get same height green box using auto layout? I want green box height = 25% of total height of device
Thanks in advance..
Upvotes: 2
Views: 805
Reputation: 2822
Since you have given the constant distance of green box from bottom so it will maintain that constant distance for all the device.
Secondly you have aligned the top of green box with topLayoutGuide so it will maintain the same for all devices.
So basically top is fixed with topLayout and bottom distance is fixed as 502. And if you run the same on different device having different screen height it will auto-resize your green box height only since other two parameters (top, bottom) are fixed.
Please add the height constraint for your green view as shown in image. It will give you greenViewHeight = 25% of superViewHeight
This is the demo created for your question
Upvotes: 1