简体   繁体   中英

how to change the multiplier height of uiview programmatically in swift4

I have created my viewController with the storyboard. I have like 3 subviews. I used the multiplier in storyboard to fix the height which is proportional to the main view Height. Let say:

Subview1.height = 0.2× height
Subview2.height = 0.5× height
Subview3.height = 0.3× height

(This just an example) I want now to change the height programmatically. I look for a solution like this:

self.Subview1.frame.size.height = 0.5 × self.view.frame.size.height

UPDATE the solution is to link the constraint from the storyboard to the custom class then a apply this solution:

Can I change multiplier property for NSLayoutConstraint?

UPDATE the solution is to link the constraint from the storyboard to the custom class then a apply this solution:

Can I change multiplier property for NSLayoutConstraint?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM