Ios 更改UITextView字体大小
我无法更改我的Ios 更改UITextView字体大小,ios,swift,fonts,uitextview,Ios,Swift,Fonts,Uitextview,我无法更改我的UITextView的fontSize,即使我设置了。isSelectable=false 下面的代码不起作用。fontSize不可编辑 let linkLabel: UITextView = { let v = UITextView() v.backgroundColor = .clear v.text = "Link" v.textColor = .lightGray v.font = UI
UITextView
的fontSize
,即使我设置了。isSelectable=false
下面的代码不起作用。fontSize
不可编辑
let linkLabel: UITextView = {
let v = UITextView()
v.backgroundColor = .clear
v.text = "Link"
v.textColor = .lightGray
v.font = UIFont(name: "AvenirNext", size: 23)
v.textAlignment = .right
v.isSelectable = false
v.isScrollEnabled = false
v.frame = CGRect(x: 0, y: 0, width: 200, height: 100)
// v.attributedText = NSAttributedString(string: "", attributes: [.underlineStyle: NSUnderlineStyle.single.rawValue])
v.translatesAutoresizingMaskIntoConstraints = false
return v
}()
您的字体大小没有任何影响,因为“AvenirNext”不存在。 试试:“AvenirNext常规” 这是一个很好的资源,可以获取iOS中包含的字体的正确字体名称
您的字体大小没有任何影响,因为“AvenirNext”不存在。 试试:“AvenirNext常规” 这是一个很好的资源,可以获取iOS中包含的字体的正确字体名称
let linkLabel: UITextView = {
let v = UITextView()
v.backgroundColor = .clear
v.text = "Link"
v.textColor = .lightGray
v.font = UIFont(name: "AvenirNext-Regular", size: 23)
v.textAlignment = .right
v.isSelectable = false
v.isScrollEnabled = false
v.frame = CGRect(x: 0, y: 0, width: 200, height: 100)
// v.attributedText = NSAttributedString(string: "", attributes: [.underlineStyle: NSUnderlineStyle.single.rawValue])
v.translatesAutoresizingMaskIntoConstraints = false
return v
}()