Snapkit: 父视图的1/3处不起作用

Created on 17 Dec 2019  ·  2Comments  ·  Source: SnapKit/SnapKit

在父视图的1/3处怎么实现呀。不是宽度1/3处。是离左边1/3处
make.width.equalToSuperview().dividedBy(3)
make.height.equalTo(49)
make.leading.equalToSuperview().dividedBy(6)。不起作用

Most helpful comment

For anyone who comes across this, my Chinese is hit or miss but I believe the question is how to get the leading edge of a view to be inset from the superview's leading edge by a multiple of the superview's width. i.e. something like make.leading.equalTo(superview.snp.width).dividedBy(6), except that attempting to do that results in NSInvalidArgumentException ... Invalid pairing of layout attributes. because it won't let you constrain a leading edge to a width

All 2 comments

For anyone who comes across this, my Chinese is hit or miss but I believe the question is how to get the leading edge of a view to be inset from the superview's leading edge by a multiple of the superview's width. i.e. something like make.leading.equalTo(superview.snp.width).dividedBy(6), except that attempting to do that results in NSInvalidArgumentException ... Invalid pairing of layout attributes. because it won't let you constrain a leading edge to a width

因为这是明显的语义错误,leading 和 left 一样,它是一个比较属性值,参考的是equalTo(view)的X值

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seljabali picture seljabali  ·  3Comments

chengkaizone picture chengkaizone  ·  3Comments

mkoppanen picture mkoppanen  ·  3Comments

semiwhale picture semiwhale  ·  3Comments

phongle6893 picture phongle6893  ·  4Comments