Search code examples
iphoneioscocoa-touch

Change TableView Header Text Color


I would like to make a simple change in my tableView. I have a custom table view background and I would like to change the Header and Footer TEXT color,

ONLY the text color.

I've seen on internet that usually we must use the delegate method to give to the table view an entire new view but I would ONLY to change the text color (and, if possibile, the shadow)...

Is there a simple way to do this avoiding create a new entire view?

Please help me.

Thank you


Solution

  • If you want the header/footer to be customized in any way other than just a custom string, you will need to create a UIView.

    This is documented in the UITableViewDataSource documentation:

    tableView:titleForHeaderInSection:

    Discussion The table view uses a fixed font style for section header titles. If you want a different font style, return a custom view (for example, a UILabel object) in the delegate method tableView:viewForHeaderInSection: instead.