各セルの背景色を順番に変更したいと思います。各uitableviewcellの背景色を変更するには
これは私の色です。そして、私は画像のように表示したいだけです。
私は現在ランダムな色で表示していますが、私は順番に表示したいと思います。
var cellColors = ["F28044","F0A761","FEC362","F0BB4C","E3CB92","FEA375"]
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! GroupTableViewCell
let randomColor = Int(arc4random_uniform(UInt32(self.cellColors.count)))
cell.contentView.backgroundColor = UIColor(hexString: self.cellColors[randomColor])
}
はcellForRowAtIndexPathでそれを行います。いくつかの問題がある場合は、コードを表示してください。 –
私は自分の質問を編集しました –