一般滚动视图ScrollView上下滑动式,使用Masonry可以去自适应内容大小,只要在最后一个控件后面增加一些ScrollView的约束即可,比如:
[_personCenterScrollView makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(weakSelf.view);
make.bottom.mas_equalTo(_EquipmentView.bottom).with.offset(5*Padding);
}];
这样就可以去自适应ScrollView内容多少,有多少都不怕。
2.问题来了:
我想横向使用ScrollView那么我的内容是否也可以自适应-->(这个问题我整不出来,呜~~)
纵向使用ScrollView时用到 bottom 这个限制属性去约束ScrollView的内容,那么横向我是否可以使用 right 这个显示属性去约束ScrollView的内容呢?
[_personCenterScrollView makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(weakSelf.view);
make.right.mas_equalTo(_EquipmentView.right).with.offset(5*Padding);
}];
我现在没整出来,我考虑过一些原因:
使用self.view去限制滚动视图中 控件 的左右边距;
我的Masnory版本太低了,没有更高的版本;
最后恳亲大家帮忙,这个问题困扰我好久了。
First of all, when using constraints in sv, you must determine the size (constraints) of the internal controls and then determine the margin relationship between the internal controls and sv.
For example: if a view is in sv, first determine the margins between the view and sv, and then determine the width and height of the view.
If there are multiple views side by side. You determine the width, height, and margins of the views
The horizontal and vertical writing methods are similar. There should be no problem with the grammar of the two Masnory sentences above. You can find out if there are other reasons. I feel that it should not be a version problem, but you can try updating it.