Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 更改UITextView字体大小_Ios_Swift_Fonts_Uitextview - Fatal编程技术网

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
    }()