I am using titleForHeaderInSection to show a header for a UITableView section. It worked fine with the iOS6 SDK, but the iOS7 SDK shows the header in all CAPS.
I guess
The solution which worked for me was to create a simple UILabel
Instance Variable to use as the section header view. (Your needs may be different, but for me, I only needed to have text in my header...)
Then, inside viewForHeaderInSection
, I set up the label as required, and return this label as the header view.
Then, whenever I want to update the text in the header, I simply change the label's text directly.
In the .h file:
@property (nonatomic, retain) UILabel *sectionHeaderLabel;
then in the .m file:
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
return [self refreshMySectionHeaderLabel]; // I created this handy little method to update the header text
}
// Get the latest text for the section header...
-(UILabel *) refreshMySectionHeaderLabel {
// Initialise the first time.
if( sectionHeaderLabel == nil ) {
sectionHeaderLabel = [[UILabel alloc] initWithFrame: CGRectNull];
}
// ...
// May also set other attributes here (e.g. colour, font, etc...)
// Figure out the text...
sectionHeaderLabel.text = @"Your updated text here...";
return sectionHeaderLabel;
}
When I want to update my section header, I simply call:
[self refreshMySectionHeaderLabel];
...or you could simply call:
sectionHeaderLabel.text = @"The new text...";
Take note: I only have 1 section (section 0). You may need to account for multiple sections...