Marsonry 约束问题

2018-06-13  本文已影响0人  foolish_hungry
1.当 UILabel 左右都有控件时, 需要动态根据屏幕宽度去算出Label的宽度

eg :

// 左面控件为 self.iYellowCircleView       右面控件为 _iScalAllCourseButton
[self.iTitleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(kAspectHeight(17));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.mas_equalTo(self.iYellowCircleView.mas_right).offset(kAspectWidth(6));
        make.right.mas_equalTo(_iScalAllCourseButton.mas_left).offset(kAspectWidth(-10)).priorityLow();
    }];

// 解决约束冲突的方法: 最后一行加上低优先级
上一篇 下一篇

猜你喜欢

热点阅读