Now I have 2 UILabels, their total width is fixed, and I wanna place them side by side, and make both of their text right-aligned. So I write(using masonry):
[self.authorLabel mas_makeConstraints:^(MASConstraintMaker *make){
make.top.equalTo(self.abstractLabel.mas_bottom).offset(verticalInnerSpacing);
make.bottom.equalTo(self.contentView.mas_bottom).offset(-bottomOffset);
make.left.equalTo(self.dateLabel.mas_right);
make.right.equalTo(self.contentView.mas_right).offset(-rightOffset);
}];
[self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make){
make.top.equalTo(self.authorLabel.mas_top);
make.bottom.equalTo(self.authorLabel.mas_bottom);
make.left.equalTo(self.thumbImage.mas_right).offset(horizontalInnerSpacing);
make.right.equalTo(self.authorLabel.mas_left);
}];
However the right label always have a width larger than its text size. What I wanna achieve is that the left label may have a blank space in front of its text, but the right label has a width depending on its text. What should I do then?
In the two images, the first one is the current effect, the second one is the effect I want.