gpt4 book ai didi

ios - Xcode 6.1 错误条件绑定(bind)中的绑定(bind)值必须是可选类型

转载 作者:行者123 更新时间:2023-11-29 02:28:08 25 4
gpt4 key购买 nike

我当前的swift代码

override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.backgroundColor = UIColor.blackColor()

if let textLabel = cell.textLabel {
textLabel.textColor = UIColor.whiteColor()
textLabel.highlightedTextColor = textLabel.textColor
}

出现错误:第 3 行“条件绑定(bind)中的绑定(bind)值必须是可选类型”:

   if let textLabel = cell.textLabel {

提前致谢。

最佳答案

cell.textLabel 在 Xcode 的每个版本中不断更改其可选状态,这非常令人恼火。检查它在您使用的版本中是如何定义的,您可能不需要可选绑定(bind)。

关于ios - Xcode 6.1 错误条件绑定(bind)中的绑定(bind)值必须是可选类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27235074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com