Using Custom Fonts with UIFont Exception

Discussion in 'iOS Programming' started by Compile 'em all, Jan 19, 2009.

  1. Compile 'em all
    Expand Collapse
    macrumors 601

    Compile 'em all

    Apr 6, 2005
    I am trying to use
    UIFont* customfont = [UIFont fontWithName:@"customfontname" size:17];
    label.font = customfont;
    to set the font of a label to a custom font i have (i.e not the builtin iphone fonts) but i am getting an exception

     *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: font != nil'
    The font is located in the resources folder of the project, so I don't know why it can't find it. The above code works when I replace my font name with a builtin one like Helvetica. The font name is correct as far as I know. is there something i am missing? thanks

Share This Page