[英]Xcode 6.1 Error bound value in a conditional binding must be Optional type
My current swift code 我当前的快速代码
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
}
is getting error: "bound value in a conditional binding must be Optional type" on the 3 line: 出现错误:第3行上的“条件绑定中的绑定值必须是可选类型”:
if let textLabel = cell.textLabel {
Thanks in advance. 提前致谢。
cell.textLabel
keeps changing its optional status with each release of Xcode, which is highly irritating. cell.textLabel
在每次发布Xcode时cell.textLabel
不断更改其可选状态,这非常cell.textLabel
。 Check to see how it's defined in the version you're using, you may not need the optional binding. 检查以查看所用版本中的定义,您可能不需要可选绑定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.