'UIFont' is not convertible to 'UIFont?'

后端 未结 3 842
花落未央
花落未央 2020-12-08 18:38

So I had updated my XCode to 7.3 today evening.

In one of my projects, I get the following error for few labels where I set the font:

\'(name: String         


        
3条回答
  •  [愿得一人]
    2020-12-08 19:45

    Elsewhere on SO, someone suggest that where you have this:

    aTitleView.font = UIFont(name: "Roboto-Regular", size: 15)
    

    ...you should try writing this:

    aTitleView.font = UIFont.init(name: "Roboto-Regular", size: 15)
    

    I can take no credit for this (because I can't reproduce the bug) so I'm just guessing! But it would be very interesting to know if it actually works.

提交回复
热议问题