2012-01-13 79 views

回答

1

你问什么,与特定的字体,是它对准太低,在Y轴上,而不是在标签的垂直中心之中。一些解决方案:

  1. 得到一个字体管理器,并用手固定的字体
  2. 调整的UILabel实例或一个UILabel子类,把它推高于它。例如,您可以通过拦截setFrame调用来实现此目的。

据我所知,UIFont并没有随身携带这些信息。它可能,但:you can check some of the read-only properties of the font

这样说,但是,你仍然不能设置属性的字体,所以你不能用这种方式调整它。

+0

cn你建议一些东西更多的第一个解决方案,因为我现在使用第二个..谢谢 – 2012-01-13 07:19:08

+0

谷歌“字体编辑软件mac“或”字体编辑软件窗口“,你会发现你需要什么。最好! – 2012-01-13 07:37:23

+0

谢谢,下载fontforge – 2012-01-13 07:52:41

0

试试这个..

UILabel *testLabel = [[UILabel alloc] initWithFrame:CGRectMake(148, 142, 130, 25)]; 
[testLabel setFont:[UIFont fontWithName:@"DBLCDTempBlack" size:20]]; 
[testLabel setText:@"MY Text"]; 
[testLabel setTextColor:[UIColor darkGrayColor]]; 
[testLabel setBackgroundColor:[UIColor clearColor]]; 
[testLabel setTextAlignment:UITextAlignmentCenter]; 
0

我以前在我的项目中使用过自定义字体。只是你必须在你的项目中添加font.tff文件,并设置你的字体setFont方法