JustANoob
JustANoob

Reputation: 65

Changing color of a UIEdgeInset swift

This might seem like a basic question, but I am creating a UIEdgeInset on the top of my table view as such:

self.tableView.contentInset = UIEdgeInsetsMake(40, 0, 0, 0)

and I was wondering how I can change the color to black, the color it is currently showing is white.

Upvotes: 0

Views: 1129

Answers (1)

Fangming
Fangming

Reputation: 25260

Content Inset is a block of empty space like a padding and you cannot change color of that area.

Alternatively, if you only want your padding area to have a black color, instead of setting inset, simply add another cell as the first cell of your table view and set the color of that cell to be black.

Or, you can set the background color of your table view to be black, and then set background color of each table cell to be white.

Upvotes: 1

Related Questions