2013-02-28 84 views
0

我使用Lucida Grande字體家族,它工作正常。ios自定義標籤不支持字體系列僅支持Lucida Grande?

FontLabel *label4 = [[FontLabel alloc] initWithFrame:CGRectMake(10, 6, 250, 50)]; 
     ZMutableAttributedString *str = [[ZMutableAttributedString alloc] initWithString:cmd_string 
                       attributes:[NSDictionary dictionaryWithObjectsAndKeys: 
                          [[FontManager sharedManager] zFontWithName:@"Lucida Grande" pointSize:12], 
                          ZFontAttributeName, 
                          nil]]; 
     label4.backgroundColor=[UIColor clearColor]; 
     [str addAttribute:ZFontAttributeName value:[[FontManager sharedManager] zFontWithName:@"Lucida Grande" pointSize:12] range:NSMakeRange(0, name_length)]; 
     [str addAttribute:ZForegroundColorAttributeName value:[UIColor colorWithRed:241/255.0f green:73.0/255.0f blue:2.0/255.0f alpha:1.0]range:NSMakeRange(0, name_length)]; 
     [str addAttribute:ZForegroundColorAttributeName value:[UIColor colorWithRed:128.0/255.0f green:121.0/255.0f blue:98.0/255.0f alpha:1.0]range:NSMakeRange(name_length, cmd_str_len-name_length)]; 
     label4.zAttributedText = str; 
     label4.numberOfLines=0; 
     [label4 sizeToFit]; 

我使用黑體,加粗字體家族也沒有工作程序crahing,請幫助我。

FontLabel *label4 = [[FontLabel alloc] initWithFrame:CGRectMake(10, 6, 250, 50)]; 
     ZMutableAttributedString *str = [[ZMutableAttributedString alloc] initWithString:cmd_string 
                       attributes:[NSDictionary dictionaryWithObjectsAndKeys: 
                          [[FontManager sharedManager] zFontWithName:@"Helvetica-Bold" pointSize:12], 
                          ZFontAttributeName, 
                          nil]]; 
     label4.backgroundColor=[UIColor clearColor]; 
     [str addAttribute:ZFontAttributeName value:[[FontManager sharedManager] zFontWithName:@"Helvetica-Bold" pointSize:12] range:NSMakeRange(0, name_length)]; 
     [str addAttribute:ZForegroundColorAttributeName value:[UIColor colorWithRed:241/255.0f green:73.0/255.0f blue:2.0/255.0f alpha:1.0]range:NSMakeRange(0, name_length)]; 
     [str addAttribute:ZForegroundColorAttributeName value:[UIColor colorWithRed:128.0/255.0f green:121.0/255.0f blue:98.0/255.0f alpha:1.0]range:NSMakeRange(name_length, cmd_str_len-name_length)]; 
     label4.zAttributedText = str; 
     label4.numberOfLines=0; 
     [label4 sizeToFit]; 
+0

有什麼錯誤和堆棧跟蹤應用程序崩潰的時候? – 2013-02-28 05:52:25

+0

線程出錯,顯示FontLabel支持文件的線程。 – San 2013-02-28 05:55:46

+0

你能告訴我們'zFontWithName'的方法定義嗎 – DivineDesert 2013-02-28 06:16:13

回答

1

露辛達大不可用在iOS中,僅在Mac OS X