Reputation: 3491
I have a small view that I want him occupy 1/3 height of superview(same size with safe area)
I defined leading space, trailing space, bottom space which its constant = 0 with superview.bottom.
AND I want to make the height 1/3 of superview height to make it same look in all iphone sizes. I defined aspect ratio and changed its first item as superview.height and second item as thisview.height. of course I have defined 3:1 multiplier
But it doesnt work it gives following error
Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal.
Come on!! why doesnt it work? this is not that complex compared to all other stuff. Also how can I complish this on interface. (not in code) I would like to see it on xcode with all other screensizes in preview tab.
Thanks a lot for your time.
Upvotes: 2
Views: 3736
Reputation: 7648
Set the view Equal Heights
with its superview. Then change the multiplier of the Equal Heights
constraint to 1:3
Upvotes: 10