I have static table and I set background color for tableview -> tableView.backgroundColor = UIColor.redColor()
and when I have etc. 3 rows in static table then is tableview colored and 3 rows are white how can I fix background color for this cells? This code are not working for static
table ->
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell
cell.textLabel!.text = numbers[indexPath.row]
cell.backgroundColor = UIColor.greenColor()
return cell
}
In static Table View you don't have to implement cellForRowAtIndexPath. So I suggest you to implement the following code:
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
// Change the color of all cells
cell.backgroundColor = UIColor.greenColor()
}