ios - Auto Layout left margin constraint based on percentage of screen width -


i have 4 buttons. want them 13% of screen width left edge , bottom edge. i'm using auto layout , size classes. know can specify number of points in interface builder storyboards won't job done when going device device. need hook constraint through iboutlet , calculate constraint there in code achieve desired result? or possible using interface builder?

this special case, can't handled in ib (afaik). these combo boxes don't contain available attributes.

do in code:

let con = nslayoutconstraint(item: myview, attribute: .left, relatedby: .equal,   toitem: fullwidthview, attribute: .width, multiplier: 0.13, constant: 0.0) 

replace myview button. replace fullwidthview view occupies whole width of device. typically uiviewcontroller.view.

and same thing .bottom, .height , fullheightview.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -