UIButton +斜体=裁剪 [英] UIButton + italic font = clipping

查看:62
本文介绍了UIButton +斜体=裁剪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是当我使用诸如Helvetica Oblique之类的斜体字体时,UIButton会剪切标题尾部(末尾大约1-2像素).有人知道该问题的解决方案吗?

The problem is that UIButton clips title tail (for about 1-2 pixels at the end) when I use italic font like Helvetica Oblique with size bigger than 13. Does anybody know a solution for this problem?

推荐答案

子类 UIButton 类,并使用以下方法覆盖setTitle:

Subclass UIButton class and override setTitle with:

-(void)setTitle:(NSString *)title forState:(UIControlState)state {[super setTitle:[NSString stringWithFormat:@%@",title] forState:state];}

这将在文本的两侧添加额外的空格.容易&简单.

This will add additional spaces from both sides of your text. Easy & simple.

这篇关于UIButton +斜体=裁剪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆