From 6d4a09097eff95464adb39064cbf5b9d0dc9f600 Mon Sep 17 00:00:00 2001 From: Matthias Hochgatterer Date: Wed, 18 Jan 2012 21:57:58 +0100 Subject: [PATCH] Fixed button textTitle frame based on title edge inset --- lib/UIKit/TUIButton.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/UIKit/TUIButton.m b/lib/UIKit/TUIButton.m index 7e953689..77fd4919 100644 --- a/lib/UIKit/TUIButton.m +++ b/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); }