ios - how to find final value of proportional constaint -
i have constraint set height of view.
the constraint proportional height constraint.
i want calculate height using constraint that's want know view height.
any apis ?
i know can manually find myself using formula don't want
lets height constraint 58% of parent view , has constant value of 10 total height assigned constraint view
the height of view be:
0.58 * parentview.frame.height + 10
the height of parentview isn't established until auto layout runs, if calculation, in override of viewdidlayoutsubviews
.
since aren't interested in calculating yourself, can read final frame height of view in override of viewdidlayoutsubviews
runs after auto layout has applied constraints.
override func viewdidlayoutsubviews() { super.viewdidlayoutsubviews() // read final view size here print(myview.frame.height) }
Comments
Post a Comment