1
我有兩個數組,一個是所有動物,另一個是selectedMnimals。無論選擇哪種動物,動物的標籤都是不同的顏色。有貓,鯨魚,蝙蝠是白色的,狗和羊是黑色的。如何在特定索引處更改標籤的顏色?
var animals = ["dog", "cat", "sheep", "whale", "bat"]
var selectedAnimals = ["cat, "whale", "bat"]
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: selectcell = table.dequeueReusableCellWithIdentifier("Cell") as! selectcell
cell.animallabel.text = animals[indexPath.row]
cell.selectionStyle = UITableViewCellSelectionStyle.None
cell.animallabel.textColor = UIColor.whiteColor
return cell
}
陣列 '主題' 什麼是更換
? – yesthisisjoe
對不起,我更新了我的代碼。 – stackerleet