r/simpleios • u/BrianZable • Dec 07 '14
[Question] Using Custom Fonts in Cocoa Touch Frameworks
Hi all,
I'm trying to create custom views in my iOS application inside of a Cocoa Touch Framework and I'd like to use FontAwesome to take advantage of some of the icons. I have my .otf file inside of the Framework because only views within that framework depend on it. I'm having issues when running my app in the simulator. In interface builder, the view renders perfectly: http://imgur.com/VH0P6Wn
The problem comes when I run the app in the simulator, the view renders like so: http://imgur.com/dMrXE0m
I'm using iOS 8 and the latest version of Xcode. I'm very confused as to what could be going wrong. Another important thing to note is that if I add a label to my view in interface builder and set the font to FontAwesome, both the UILabel AND the custom view I am trying to make will both render correctly. If I delete the label, the custom view goes back to having that error icon. It seems like it has something to do with how the font is being loaded, however, I can't seem to find a resource that can point me in the right direction.
1
u/brendan09 Dec 07 '14 edited Dec 07 '14
2 things that may be doing it:
Build your app, right click on it the .app file under "Products" in the sidebar of Xcode where your files are. Open the location in Finder. Right-click on the .app file, then click "Show Contents". Browse around and see if you can find your font file. If you can't, its definitely something related to #2. But, #1 is still required as well.
Xcode just indexes folders and adds the fonts to the list. If they're installed on your Mac, they may also show up as well. It doesn't validate plist / build phase / compile / target settings to make sure they're right.