84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
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)); }];
闭关修行中......
In View
- (void)layoutSubviews { [super layoutSubviews]; // 获取到约束后的控件frame }
In controller
- (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; // 获取到约束后的控件frame }
Reference materials: https://github.com/SnapKit/Ma...Other information: http://elijahdou.github.io/ui...
Extract 45 as a variable
All constraints loaded through masonry can be passedNSArray *installedConstraints = [MASViewConstraint installedConstraintsForView:self.choseCityBtn]
Get.Then you loop through the array and find the constraint you want
Get it from NSConstraint.
After setting up, force refresh setNeedDisplay and then you can get the attributes after the forced refresh through the frame
In View
In controller
Reference materials: https://github.com/SnapKit/Ma...
Other information: http://elijahdou.github.io/ui...
Extract 45 as a variable
All constraints loaded through masonry can be passed
NSArray *installedConstraints = [MASViewConstraint installedConstraintsForView:self.choseCityBtn]
Get.
Then you loop through the array and find the constraint you want
Get it from NSConstraint.
After setting up, force refresh setNeedDisplay and then you can get the attributes after the forced refresh through the frame