Reputation: 4614
I have added a custom font in to my application and i set that custom font for some of the buttons by sub classing the custom font,in xib custom font set perfectly
but while execute in device the font auto adjust to upside in all the button.
Here is my custom font sub class code.
@interface ButtonWithBebasNeueFont : UIButton
@end
@implementation ButtonWithBebasNeueFont
- (void)awakeFromNib
{
[super awakeFromNib];
self.titleLabel.font = [UIFont fontWithName:@"BebasNeue" size:self.titleLabel.font.pointSize];
}
@end
Please guide me to fix this issue.
Thanks.
Upvotes: 0
Views: 526
Reputation: 6039
The problem you're seeing is a result of the font's ascender property being too small. You have two options:
Set the title edge insets of the button like so:
self.titleEdgeInsets = UIEdgeInsetsMake(TOP, LEFT, BOTTOM, RIGHT);
Just substitute TOP, LEFT, BOTTOM, RIGHT
with your values.
Upvotes: 1