84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
oc 如何获得用 Masonry 约束好的宽度?例子:
/// 怎样获取里面约束好的 45 呢?请问!! [self.choseCityBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(@(12)); make.width.equalTo(@(45)); make.height.equalTo(@(24)); make.centerY.equalTo(@(navCenterY)); }];
闭关修行中......
在View里
- (void)layoutSubviews { [super layoutSubviews]; // 获取到约束后的控件frame }
在controller里
- (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; // 获取到约束后的控件frame }
参考资料: https://github.com/SnapKit/Ma...其他资料: http://elijahdou.github.io/ui...
把45提取出来作为一个变量
所有通过masonry加载约束,可以通过NSArray *installedConstraints = [MASViewConstraint installedConstraintsForView:self.choseCityBtn]
获得。然后你循环遍历数组,找到你要的那个约束就好了
从 NSConstraint 里面拿。
设置完了之后 强制刷新setNeedDisplay 之后可以通过frame拿到强制刷新之后的属性
在View里
在controller里
参考资料: https://github.com/SnapKit/Ma...
其他资料: http://elijahdou.github.io/ui...
把45提取出来作为一个变量
所有通过masonry加载约束,可以通过
NSArray *installedConstraints = [MASViewConstraint installedConstraintsForView:self.choseCityBtn]
获得。
然后你循环遍历数组,找到你要的那个约束就好了
从 NSConstraint 里面拿。
设置完了之后 强制刷新setNeedDisplay 之后可以通过frame拿到强制刷新之后的属性