为表格视图单元格添加自定义字体
adding custom font for tableview cells
我想在我的应用程序中添加自定义字体,所以我将其添加到此处,就像我对其他标签所做的那样。
let question = QuestionController.questionsList[questionIndex]
cell.nameLabel.text = question.answers?[indexPath.row]
cell.nameLabel.numberOfLines = 0
cell.nameLabel.lineBreakMode = .byWordWrapping
cell.nameLabel.font = UIFont(name: "USIS 1949", size, 25)
我无法在 table 单元格中为 header/rows 工作。相反,我有这个错误:
Cannot invoke initializer for type 'UIFont' with an argument list of type '(name: String, (UIContentContainer, CGSize) -> CGSize, Int)'
有没有简单的解决方法?我是否在错误的部分包含了字体?
试试这个:
let question = QuestionController.questionsList[questionIndex]
cell.nameLabel.text = question.answers?[indexPath.row]
cell.nameLabel.numberOfLines = 0
cell.nameLabel.lineBreakMode = .byWordWrapping
cell.nameLabel.font = UIFont(name: "USIS 1949", size: 25)
我想在我的应用程序中添加自定义字体,所以我将其添加到此处,就像我对其他标签所做的那样。
let question = QuestionController.questionsList[questionIndex]
cell.nameLabel.text = question.answers?[indexPath.row]
cell.nameLabel.numberOfLines = 0
cell.nameLabel.lineBreakMode = .byWordWrapping
cell.nameLabel.font = UIFont(name: "USIS 1949", size, 25)
我无法在 table 单元格中为 header/rows 工作。相反,我有这个错误:
Cannot invoke initializer for type 'UIFont' with an argument list of type '(name: String, (UIContentContainer, CGSize) -> CGSize, Int)'
有没有简单的解决方法?我是否在错误的部分包含了字体?
试试这个:
let question = QuestionController.questionsList[questionIndex]
cell.nameLabel.text = question.answers?[indexPath.row]
cell.nameLabel.numberOfLines = 0
cell.nameLabel.lineBreakMode = .byWordWrapping
cell.nameLabel.font = UIFont(name: "USIS 1949", size: 25)