I'm creating a UITableViewHeaderFooterView from a xib file, and almost everything is working properly.
The problem is that now when I try to change the background color (or if I had one configured in the xib), it will constantly output this message to the console:
Setting the background color on UITableViewHeaderFooterView has been deprecated. Please use contentView.backgroundColor instead.
This means I have two problems:
- If I don't want to see that warning, I must get rid of the background color in the xib file.(This is undesirable because then it means my xib no longer reflects what the view will look like at runtime).
- When I attempt to change the background color via code, I get the
contentView.backgroundColor
suggestion, but when I try to follow that suggestion, nothing happens. (This is becausecontentView
isnil
.)
Note: There is a similar question here, but that was mainly concerned with muting the message, not finding an alternative solution that resolves both problems above.
Update: To be clear, I want to continue using a xib file for the header view, and want to be able to call dequeueReusableHeaderFooterViewWithIdentifier: so that the table can be efficient in its management of the views.