Skip to content

Commit

Permalink
Remove EbrCenterTextInRectVertically (#1882)
Browse files Browse the repository at this point in the history
Changes UITabBarButton to directly center text vertically in drawRect:
Removes dead code from UITextView-sizeThatFits:

Fixes #1812
  • Loading branch information
aballway authored Feb 1, 2017
1 parent 1f0515a commit bb8777c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
12 changes: 3 additions & 9 deletions Frameworks/UIKit/UITabBarButton.mm
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,9 @@ - (void)drawRect:(CGRect)pos {
id font = [UIFont defaultFont];
size = [title sizeWithFont:font constrainedToSize:CGSizeMake(0.0f, 0.0f) lineBreakMode:UILineBreakModeClip];

CGRect textRect;
textRect.origin.y = rect.size.height - size.height;
textRect.origin.x = rect.origin.x;
textRect.size.width = rect.size.width;
textRect.size.height = size.height;
// TODO(DH)
// EbrCenterTextInRectVertically(&textRect, &size, font);

CGContextSetFillColorWithColor(context, (CGColorRef)[UIColor whiteColor]);
// Vertically center text
CGRect textRect = CGRectMake((rect.size.height - size.height) / 2.0, rect.origin.x, rect.size.width, size.height);
CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorWhite));
size = [title drawInRect:textRect withFont:font lineBreakMode:UILineBreakModeClip alignment:UITextAlignmentCenter];
}
}
Expand Down
9 changes: 0 additions & 9 deletions Frameworks/UIKit/UITextView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -757,15 +757,6 @@ - (CGSize)sizeThatFits:(CGSize)fitSize {
CGSize fontExtent = { 0, 0 };

fontExtent = [[self _text] sizeWithFont:(id)_font forWidth:rect.size.width lineBreakMode:UILineBreakModeWordWrap];

CGRect centerRect;
centerRect.origin.x = 0;
centerRect.origin.y = 0;
centerRect.size = fontExtent;
// TODO(DH)
// EbrCenterTextInRectVertically(&centerRect, &fontExtent, _font);
rect.origin.y += centerRect.origin.y;

ret.width = ourRect.size.width;
ret.height = fontExtent.height + _marginSize * 2.0f;

Expand Down

0 comments on commit bb8777c

Please sign in to comment.