我如何在 swift 中将字体更改为 UITextView?
How i can change font to UITextView in swift?
伙计们,我希望我的 textView
有这种字体:"Apple SD Gothic Light"
...
我这里用的这段代码属于:
if (titolo.text == NSLocalizedString("SEVENTH_ANNOTATION_TITLE", comment: "")){
// aggiungo le immagini all'array
pageImages = [UIImage(named: "TeatroMassimoBellini1.png")!,
UIImage(named: "TeatroMassimoBellini2.png")!,
UIImage(named: "TeatroMassimoBellini3.png")!]
textFieldDescrizione.text = NSLocalizedString("SEVENTH_ANNOTATION_DESCRIPTION", comment: "")
textFieldDescrizione.font = UIFont.preferredFontForTextStyle("AppleSDGothicNeo-Light")
textFieldDescrizione.textAlignment = NSTextAlignment.Justified
}
但它不起作用....你能帮我吗?
对不起我的英语不好! :)
试试这个:
textFieldDescrizione.font = UIFont(name: "NameOfTheFont", size: 20)
对于 Swift 4 ,这对我有用
textView.font = UIFont(name: "Courier", size: 20)
伙计们,我希望我的 textView
有这种字体:"Apple SD Gothic Light"
...
我这里用的这段代码属于:
if (titolo.text == NSLocalizedString("SEVENTH_ANNOTATION_TITLE", comment: "")){
// aggiungo le immagini all'array
pageImages = [UIImage(named: "TeatroMassimoBellini1.png")!,
UIImage(named: "TeatroMassimoBellini2.png")!,
UIImage(named: "TeatroMassimoBellini3.png")!]
textFieldDescrizione.text = NSLocalizedString("SEVENTH_ANNOTATION_DESCRIPTION", comment: "")
textFieldDescrizione.font = UIFont.preferredFontForTextStyle("AppleSDGothicNeo-Light")
textFieldDescrizione.textAlignment = NSTextAlignment.Justified
}
但它不起作用....你能帮我吗? 对不起我的英语不好! :)
试试这个:
textFieldDescrizione.font = UIFont(name: "NameOfTheFont", size: 20)
对于 Swift 4 ,这对我有用
textView.font = UIFont(name: "Courier", size: 20)