简体   繁体   中英

adding custom fonts to application

In my project, I'm using a custom font named "COMICS.TTF"... For that I added the font file named "COMICS.TTF" into resources and edited the plist to include a new field specifying "Fonts provided by the application COMICS.TTF "

After that, I accessed the font usig UIFont's fontWithName:@"Comics" size:40.0 method... (Comics is the font name that I got when I tried to NSLog font names)... All these worked perfectly in iPhone 4... But, when I tried to install the program in iOS3.1, it is throwing an exception as follows...

*** Assertion failure in -[UILabel setFont:], /SourceCache/UIKit/UIKit-984.38/UILabel.m:445
2011-03-07 14:24:20.271 CMB[183:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: font != nil'
2011-03-07 14:24:20.291 CMB[183:207] Stack: (
    853417245,
    845594132,
    852966195

Also, it's not showing the font name when tried to NSLog the font name... Does anybody know, what's the problem?

添加自定义字体在3.2及更高版本中可用,因此,如果您尝试在3.1上使用它,它将无法正常工作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM