【发布时间】:2019-11-26 18:48:34
【问题描述】:
目前我有一个UITableView,用户可以在其中添加cells,其中有一个textLabel。
这就是我设置label的方式:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: WhishCell.reuseID, for: indexPath)
let currentWish = self.wishList[indexPath.row]
cell.textLabel?.text = currentWish.wishName
cell.backgroundColor = .clear
return cell
}
我的问题是,我如何自定义 textLabel(字体、约束、...)。我尝试在我的WishCell 类中创建一个自定义UILabel,但我无法在cellforRowAt 和cell.theLabel 中访问它。
希望你能理解我的问题,我非常感谢每一个帮助:)
已解决
我只是忘记了cellForRowAt 中的as! WhishCell。感谢您的所有帮助:)
【问题讨论】:
-
是的,我正在这样做。但我的问题是我需要自定义
textLabel,我不知道如何
标签: ios swift uitableview