Created
October 25, 2013 23:39
-
-
Save priore/7163478 to your computer and use it in GitHub Desktop.
How to put an image and a bottom text together in a UIButton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIButton (Style) | |
const CGFloat kImageTopOffset = -15; | |
//const CGFloat kTextBottomOffset = -30; | |
- (void)centerButtonImageTopAndTextBottomWithOffset:(CGFloat)bottomOffset | |
{ | |
[self setTitleEdgeInsets:UIEdgeInsetsMake(0.0, -self.imageView.image.size.width, -bottomOffset, 0.0)]; | |
[self setImageEdgeInsets:UIEdgeInsetsMake(kImageTopOffset, 0.0, 0.0, -self.titleLabel.bounds.size.width)]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment