Search code examples
objective-ciosfontsuifontios3.0

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?


Solution

  • 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