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
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