我已經在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爲什麼你不接受我的答案?它不工作? –