开发者

adding custom fonts to application

开发者 https://www.devze.com 2023-02-15 01:15 出处:网络
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

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开发者_JS百科 font name... Does anybody know, what's the problem?


adding your custom fonts became available in 3.2 and later versions so, if you are trying to use it on 3.1 it won't work

0

精彩评论

暂无评论...
验证码 换一张
取 消