UILabel 调整字体以适合文本

UILabel Adjust Font to Fit text

我收到此代码的错误

cell.label.numberOfLines = 2
cell.label.text = adjust1
cell.label.font = UIFont.systemFontOfSize(12.0)
cell.label.adjustsFontSizeToFitWidth

错误在这一行

cell.label.adjustsFontSizeToFitWidth

错误是

The Expression resolves to an unused I-value

需要修复

替换为:

cell.label.adjustsFontSizeToFitWidth

有了这个:

cell.label.adjustsFontSizeToFitWidth = true