How can vCenter the relative view offset?
HParis opened this issue · 4 comments
HParis commented
How can I cover the AutoLayout like below to PinLayout.
let view1 = UIView()
let view2 = UIView()
addSubview(view1)
addSubview(view2)
view1.centerXAnchor.constraint(equalTo: view2.centerYAnchor, constant: -20)
view1.widthAnchor.constraint(equalTo: view2.widthAnchor, constant: -20)
lucdion commented
What are you trying to achieve exactly @HParis? It would helps me to give you the best solution.
HParis commented
What are you trying to achieve exactly @HParis? It would helps me to give you the best solution.
The width of viewA is 80% relate the superview.
And how can I set the width of viewB is less than the width of viewA, like 20px?
iWECon commented
import PinLayout
// ...
view1.pin.width(80%)
view2.pin.width(view1.frame.width - 20).center(to: view1.anchor.center)
lucdion commented
Very old topic. Closing it, sorry