Je veux changer la couleur de chaque arrière-plan de la cellule dans l'ordre.Comment changer chaque couleur de fond de uitableviewcell
Ceci est mes couleurs.Et je veux juste les montrer comme indiqué dans l'image.
Je le montre avec des couleurs aléatoires maintenant.Mais je veux les montrer dans l'ordre.
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])
}
font en cellForRowAtIndexPath. Si vous avez des problèmes, montrez-nous le code. –
J'ai modifié ma question –