I\'ve got various views in my iPhone application that require padding e.g a custom UIButton with text aligned left, and a UILabel with a background color.
This may be a
What about creating a custom class that extends UIButton and overriding this:
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
return UIEdgeInsetsInsetRect(contentRect, UIEdgeInsetsMake(topPadding, rightPadding, bottomPadding, leftPadding));
}
In the case of UILabel just override:
- (CGRect)textRectForBounds:(CGRect)bounds
limitedToNumberOfLines:(NSInteger)numberOfLines;