2012-01-13 74 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方法