【发布时间】:2016-05-30 05:32:38
【问题描述】:
我在 swift 中创建了一个 tableview,我正在自定义外观以使其看起来更好。我想更改外观以具有清晰的背景和白色文本颜色。表格视图功能:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:UITableViewCell = self.myTableView
.dequeueReusableCellWithIdentifier("cell")! as UITableViewCell
let score = scores[indexPath.row]
cell.textLabel!.text = String(score.gameScore!)
UITableViewCell.appearance().textLabel?.textColor = UIColor.whiteColor();
UITableViewCell.appearance().backgroundColor = UIColor.clearColor();
return cell;
}
所以第二部分适用于透明细胞,但第一部分由于某种原因不能。我在网上查看了一些资源,但似乎无法正确理解:
How to change text color in tableView section in swift
https://www.natashatherobot.com/ios-change-uitableviewcell-selection-color-app-wide/
任何帮助将不胜感激!谢谢
【问题讨论】:
标签: swift uitableview