使用Swift更改文本颜色 [英] Changing text color with Swift

查看:154
本文介绍了使用Swift更改文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在表格视图中更改单元格的文字颜色。
如果我这样做它不工作。在xcode6 beta 1它的工作,但在xcode6的最终版本不工作。

I'd like to change the text color of a cell in my table view. If i do this it's not working. In xcode6 beta 1 it works but on the final version of xcode6 it's not working.

代码:

cellGrow.textColor = UIColor.whiteColor()

错误:'textColor'不可用:截至iOS 7及更早版本的API已在Swift中无法使用

推荐答案

cellGrow是一个UITableViewCell吗?在这种情况下使用: -

Is cellGrow a UITableViewCell? In that case use this:-

cellGrow.textLabel?.textColor = UIColor.whiteColor()

这篇关于使用Swift更改文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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