Skip to content

Commit

Permalink
[NavigationBar] Pixel-align title (#2043)
Browse files Browse the repository at this point in the history
* [NavigationBar] Pixel-align title

On 3x devices, centering the Title label was not aligning the origin to
pixels, resulting in blurry text.

Closes #2039

* Removing scale check - a separate PR will make it safer
  • Loading branch information
Robert Moore committed Sep 27, 2017
1 parent 0f30544 commit 7f798da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/NavigationBar/src/MDCNavigationBar.m
Expand Up @@ -317,8 +317,9 @@ - (void)layoutSubviews {
CGRect alignedFrame = [self mdc_frameAlignedVertically:titleFrame
withinBounds:textFrame
alignment:titleVerticalAlignment];
_titleLabel.frame =
[self mdc_frameAlignedHorizontally:alignedFrame alignment:self.titleAlignment];
alignedFrame = [self mdc_frameAlignedHorizontally:alignedFrame alignment:self.titleAlignment];

_titleLabel.frame = MDCRectAlignToScale(alignedFrame, self.window.screen.scale);
self.titleView.frame = textFrame;

// Button and title label alignment
Expand Down

0 comments on commit 7f798da

Please sign in to comment.