我已经阅读了大多数关于此主题的所有问题和解答,它们似乎都适用于自定义字体,而不适用于系统字体。系统字体在iOS模拟器中不工作
即时通讯使用接口生成器,并在SpriteKit场景上有一个SKLabelNode,我将字体更改为'Lithos Pro'。它在IB中正确显示,但在模拟器中运行时显示通用字体。我还以编程方式将UITextField添加到场景中,试图使用不工作的相同字体。
从我的理解,这是作为NSFont包的一部分,但只是为了确认我将TTF文件添加到项目中,并将它们包含在我的目标资源中。仍然没有去。
想法?
nameField = UITextField(frame: CGRect(x: view.center.x - 150,y:view.center.y - 25,width: 300, height: 50))
nameField.font = UIFont(name: "Lithos Pro Regular", size: 25) //I've tried 'Lithos Pro, LithosPro, and Lithos Pro Regular'
nameField.textAlignment = .center
nameField.borderStyle = UITextBorderStyle.roundedRect
nameField.autocorrectionType = UITextAutocorrectionType.no
nameField.keyboardType = UIKeyboardType.default
nameField.returnKeyType = UIReturnKeyType.done
nameField.clearButtonMode = UITextFieldViewMode.whileEditing;
nameField.contentVerticalAlignment = UIControlContentVerticalAlignment.center
view.addSubview(nameField)
'Lithos Pro Regular'不是系统字体。 –