简体   繁体   English

条件绑定中的Xcode 6.1错误绑定值必须是Optional类型

[英]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.

相关问题 条件绑定中的绑定值必须是可选类型 - bound value in conditional binding must be of optional type 条件绑定中的绑定值必须是可选类型 - Bound value in a conditional binding must be of optional type 条件绑定中的Swift Bound值必须是Optional类型 - Swift Bound value in a conditional binding must be of Optional type 条件绑定中的绑定值必须为可选类型[IOS-SWIFT] - Bound value in a conditional binding must be of Optional type [IOS - SWIFT] (快速)tableView应用程序iOS失败,因为“条件绑定中的绑定值必须是可选类型” - (Swift) tableView application iOS fails because of “Bound value in a conditional binding must be of Optional type” 条件绑定的初始化程序必须具有Optional类型,而不是'IndexPath'-Xcode 8,Swift 3 - Initializer for conditional binding must have Optional type, not 'IndexPath' - Xcode 8, Swift 3 条件绑定的初始化程序必须具有可选类型,而不是'Error.Protocol' - Initializer for conditional binding must have Optional type, not 'Error.Protocol' 出现此错误:条件绑定的初始化程序必须具有Optional类型,而不是'Bool' - Getting this error : Initializer for conditional binding must have Optional type, not 'Bool' Swift错误:条件绑定的初始化程序必须具有可选类型,而不是'()' - Swift error: Initializer for conditional binding must have Optional type, not '()' 条件绑定的初始化程序必须具有可选类型 - Initializer for conditional binding must have optional type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM