Custom Fonts returning Null value when depolyed in simulator

uma12uma12 USMember

I am using custom fonts in my iOS application , The Fonts work fine with ios device . However, they raise a null exception when deployed in emulator.

Sample Code:
UIFont font13Calibri = UIFont.FromName("Calibri", 13f);
UIFont font12Calibri = UIFont.FromName("Calibri", 12f);

The Font variables font13Calibri and font12Calibri is most of the times null (in simulator).

Answers

  • PrayaasPrayaas USMember

    Do you need to create these variables? Is there an alternate method you could work with, for example assigning UIFont.FromName(...) directly every time? If you need one font size multiple times, you could create a variable for it.

    To answer the question, have you tried right clicking your project and cleaning it? Also remove the older version from the Simulator before deploying the new one. Somehow this works many times for runtime exceptions that shouldn't happen – leftover files and data.

Sign In or Register to comment.