简体   繁体   中英

How to make background color in viewForHeaderInSection the same as one in titleForHeaderInSection?

I want to highlight one of the titles in grouped section, just like the Calendar application. I am trying to use UILabel as the return view in viewForHeaderInSection. But I am not sure what color is in the default heder. Does anyone know? Thanks a lot.

Just ran across this one myself -- rather a late response, but in case somebody else runs across it, this worked for me:

[label setBackgroundColor:[tableView backgroundColor]];

where, of course, label is the UILabel * that you're using for your header view. Rather than hardcoding a color, just use whatever background color the table view itself is using.

This comes very close:

[UIColor colorWithRed:.6 green:.65 blue:.69 alpha:.9]

You'd need to design a custom view to emulate the gradient and the bottom border.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM