Is it possible to adjust the x,y position for the titleLabel
of a UIButton
?
Here is my code:
UIButton *btn = [UIButton but
Derive from UIButton and implement the following method:
- (CGRect)titleRectForContentRect:(CGRect)contentRect;
Edit:
@interface PositionTitleButton : UIButton
@property (nonatomic) CGPoint titleOrigin;
@end
@implementation PositionTextButton
- (CGRect)titleRectForContentRect:(CGRect)contentRect {
contentRect.origin = titleOrigin;
return contentRect;
}
@end