Skip to content

Commit

Permalink
Allow stereo cell labels to take up all available space (#5476)
Browse files Browse the repository at this point in the history
The problem:

The label wasn't taking up all available space. That way, with sufficiently short text, a right aligned Arabic label would appear to be left aligned. See before and after pics from the view debugger below.

The solution:

Allow stereo cell labels to take up all available space.

Before:
<img width="565" alt="screen shot 2018-10-22 at 4 42 29 pm" src="https://user-images.githubusercontent.com/8020010/47318438-11260c00-d61a-11e8-9c25-c541dfabf9ca.png">

After:
<img width="561" alt="screen shot 2018-10-22 at 4 43 40 pm" src="https://user-images.githubusercontent.com/8020010/47318437-11260c00-d61a-11e8-8c93-a9594970aa63.png">

Closes #5473.
  • Loading branch information
andrewoverton committed Oct 23, 2018
1 parent 30fe5bb commit b47b889
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions components/List/src/private/MDCSelfSizingStereoCellLayout.m
Expand Up @@ -109,9 +109,7 @@ - (void)assignFramesForTextContainer:(UIView *)textContainer
const CGSize fittingSize = CGSizeMake(textContainerWidth, CGFLOAT_MAX);

CGSize titleSize = [titleLabel sizeThatFits:fittingSize];
if (titleLabel.numberOfLines != 0 && titleSize.width > textContainerWidth) {
titleSize.width = textContainerWidth;
}
titleSize.width = textContainerWidth;
const CGFloat titleLabelMinX = 0;
CGFloat titleLabelMinY = 0;
CGPoint titleOrigin = CGPointMake(titleLabelMinX, titleLabelMinY);
Expand All @@ -121,9 +119,7 @@ - (void)assignFramesForTextContainer:(UIView *)textContainer
self.titleLabelFrame = titleFrame;

CGSize detailSize = [detailLabel sizeThatFits:fittingSize];
if (detailLabel.numberOfLines != 0 && detailSize.width > textContainerWidth) {
detailSize.width = textContainerWidth;
}
detailSize.width = textContainerWidth;
const CGFloat detailLabelMinX = 0;
CGFloat detailLabelMinY = CGRectGetMaxY(titleFrame);
if (titleLabel.text.length > 0 && detailLabel.text.length > 0) {
Expand Down

0 comments on commit b47b889

Please sign in to comment.