私は素早くテーブルビューを作成しました。外観をカスタマイズして見栄えを良くしています。私は、外観をクリアな背景と白いテキストの色に変更したいと思います。テーブルビュー機能: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;
}
したがって、2番目の部分はクリアなセルで動作しますが、最初の部分は何らかの理由で動作しません。私はオンラインのいくつかのソースをチェックアウトしたが、この1つの権利を取得するように見えることはできません。
How to change text color in tableView section in swift
https://www.natashatherobot.com/ios-change-uitableviewcell-selection-color-app-wide/
任意の助けをいただければ幸いです!ありがとう
@ThirtyKnotsなぜあなたは私の答えを受け入れていませんか?それは働いていないのですか? –