Custom fonts on iOS app - working in Simulator but not iPad

前端 未结 8 1193
故里飘歌
故里飘歌 2021-02-08 07:11

Encountering a weird problem here. I\'m developing a game for my school project (non-commercial), and I\'m using a custom font Black Chancery (free under GNU GPL). I followed th

8条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-08 08:11

    My answer is different from all the rest. I had a problem because the font was all one word and lowercase "compassnormal.ttf" and the name in the file was Compass. So, my code was:

    [UIFont fontWithName:@"Compass" size:24]]
    

    Bundle Resource said: compassnormal.ttf

    ~info.plist said: compassnormal.ttf

    None of this worked until I changed the actual filename to match it's official name in fontbook.

    1. deleted all references from Bundle Resources and ~info.plist;
    2. added font with updated name to Bundle Resources;
    3. updated plist with new name;
    4. tested in simulator and on device, Voila!

提交回复
热议问题