上下文成员在 Swift 3 中没有关联值 [英] Contextual member has no associated value in Swift 3
本文介绍了上下文成员在 Swift 3 中没有关联值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
翻译代码时
$0.backgroundColor = .redColor()
进入 Swift 3 我收到此错误:
Into Swift 3 I'm receiving this error:
/Users//Documents/projects//MyCell.swift:52:35:上下文成员redColor"没有关联值
/Users//Documents/projects//MyCell.swift:52:35: Contextual member 'redColor' has no associated value
如何手动翻译此代码?
推荐答案
在 Swift 3 中 .redColor()
更改为 .red
.
In Swift 3 .redColor()
is changed to just .red
.
$0.backgroundColor = .red
有关此内容的更多详细信息,请阅读 UIColor
Apple 文档> 在 Symbols
部分下检查 Type Properties
.
For more detail about this read Apple Documentation on UIColor
under Symbols
section check Type Properties
.
这篇关于上下文成员在 Swift 3 中没有关联值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文