Masonry布局心得

元素靠右,但太长时不能超过左边元素的右边界,右边用省略号结尾

Masonry布局心得_第1张图片
Masonry.jpg
  1. groupLabel的left与timeLabel的right的距离为5,groupLabel的right与cell右边缘对齐。(即将timeLabel与cell右边缘之间的区域全部给groupLabel)

  2. groupLabel.text右对齐
    _groupLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    _groupLabel.textColor = [YNThemeCommonUtils text3Color];
    _groupLabel.font = [YNThemeCommonUtils text3Font];
    _groupLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_groupLabel];

     [_groupLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
         make.right.equalTo(self.widthControlView);
         make.top.equalTo(self.timeLabel);
         make.left.equalTo(self.timeLabel.mas_right).with.offset(5);
     }];
     [_groupLabel sizeToFit];

你可能感兴趣的:(Masonry布局心得)