6.0.1 和表更改“UILabel?没有名为“text"的成员 [英] 6.0.1 and Table changes "UILabel? does not have a member named 'text"

查看:26
本文介绍了6.0.1 和表更改“UILabel?没有名为“text"的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 Swift 表格演示,在 6.0.1 下,它们似乎都有相同的错误消息.不知道如何解决这个问题:

I'm working my way through the Swift table demos, and all of them seem have this same error message under 6.0.1. Not sure how to tackle this:

推荐答案

试试这个:

cell.textLabel!.text = self.tableData[indexPath.row]

并在此处阅读有关可选项的文章:Swift 中的可选项

And read this article about optionals here: Optionals in Swift

更新:

现在使用更好的方法:

cell.textLabel?.text = self.tableData[indexPath.row]

这篇关于6.0.1 和表更改“UILabel?没有名为“text"的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆