I have a custom section header view class implemented using the storyboard. I can set the various labels and views as required when the view is loaded within the viewForHeaderInSection method.
static NSString *CellIdentifier = @"HeaderCell";
HourlyCustomTableSectionHeader* headerCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSString *sectionHeaderTitle = [[NSString alloc] init];
if(section==0){
sectionHeaderTitle = @"TODAY";
headerCell.CustomHeaderTitle.text = sectionHeaderTitle;
}
However, I want to update some of these from another method that is run each time a new cell is viewable.
Basically- I'd like to set the background colour of the section header to match the uppermost cell and be updated as the user scrolls.
I having a problem trying to reference the properties I want to update. For simplicities sake I am trying to update the custom text label first.
HourlyCustomTableSectionHeader* customSectionHeadObj = [[HourlyCustomTableSectionHeader alloc] init];
customSectionHeadObj.CustomHeaderTitle.text = @"new title";
Xcode seems to be fine with the path (no errors shown) and I can see the method is being called fine each time the table view is updated and a new cell is in view but the label in the section header is not being updated.
Am I going about this the right way? Or perhaps I need to refresh the section header to make the update visible?
I think, it good idea to for it on:
and, you should check, in which queue/thread are you call label update, it should be called only from main thread