Cyril Gaillard Cyril Gaillard - 1 year ago 208
iOS Question

custom font on UIbutton title clipped on top of word

I have uploaded a custom font and applied this font on the title of a UIbutton using the following code

videoButton.titleLabel.font = [UIFont fontWithName:@"LaurenScript" size:20];

The problem is that the title is being clipped on the top of the first letter (see photo below). I tried the same font on the UIlabel and it works fine so it is not a problem with the font. I tried also to change the rectFrame using

[videoButton.titleLabel setFrame:CGRectMake(0, 0, 300, 600)];

but that didn't do anything.
Has anybody a clue of how I can fix this problem?

enter image description here

Answer Source

I had a similar problem, where a diaeresis got cut off on top of the titlelabel. I made a UIButton subclass and used this code to fix the problem:

    [super layoutSubviews];

    CGRect frame = self.titleLabel.frame;
    frame.size.height = self.bounds.size.height;
    frame.origin.y =;
    self.titleLabel.frame = frame;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download