问题
For iOS 7/8 when setting a text's parameters programmatically, it would display as expected when compiled/built to run on device. However, when testing my app for iOS9 in Xcode 7 all my views' frames are off or just plain not visible due to the text.font
not recognizing the font. It's not a custom font per se, it's in Apple's library, and in fact, when you set a label via IB it displays properly, but when doing the same thing in code it simply displays the system font. Any ideas how to circumvent this issue? It's creating quite an ugly view in iOS9 but everything still displays properly <=iOS8.
The font in question is "Heiti TC Light"
I got the post script name from Apple's Font Book and apply it accordingly:
@"STHeitiTC-Light"
Again, works in all iOS versions except iOS9
Using Xcode 7.0 beta 3 | iOS 9 simulator
回答1:
It seems Apple has concluded support for this specific font in the Xcode build. It only displayed in the IB because it was cached from the previous Xcode version and retained through the upgrade.
For users with this same issue with their font, it still may be a valid OS font, but they may have removed it from Xcode. I would suggest starting a new project to see if your font is still a supported font by changing the font in IB of the new project, if it's not listed you will have to copy the font.ttc from Font Book to the project and include it in your info.plist like other custom fonts.
来源:https://stackoverflow.com/questions/31369253/xcode-7-ios9-font-no-longer-recognized