Fixed button textTitle frame based on title edge inset #96

Open
wants to merge 1 commit into
from
View
9 lib/UIKit/TUIButton.m
@@ -198,10 +198,11 @@ - (void)drawRect:(CGRect)r
CGContextTranslateCTM(ctx, _titleEdgeInsets.left, _titleEdgeInsets.bottom);
if(!key)
CGContextSetAlpha(ctx, 0.5);
- CGRect titleFrame = self.bounds;
- titleFrame.size.width -= (_titleEdgeInsets.left + _titleEdgeInsets.right);
- _titleView.frame = titleFrame;
- [_titleView drawRect:_titleView.bounds];
+ _titleView.frame = CGRectMake(_titleEdgeInsets.left,
+ _titleEdgeInsets.top,
+ bounds.size.width - _titleEdgeInsets.left - _titleEdgeInsets.right,
+ bounds.size.height - _titleEdgeInsets.top - _titleEdgeInsets.bottom);
+ [_titleView drawRect:_titleView.bounds];
CGContextRestoreGState(ctx);
}