我已经在swift中创建了一个tableview,并且我正在自定义外观以使它看起来更好。我想改变外观以获得清晰的背景和白色文字颜色。 Tableview功能:如何更改tableview swift中文本的颜色?
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/
任何帮助将不胜感激!谢谢
@ThirtyKnots为什么你不接受我的答案?它不工作? –