If you are using the same code for tables with and without section headers
there’s a good chance that you have some logic like the code below. The
important point to note with the release of iOS5 is that it is no longer
suitable in iOS5 to only return nil on the - (UIView )
tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section
if you don’t want the section header to show. You now need to explicitly set a
height of 0 for the section header.
If you don’t follow this rule, you may end up with an empty section header
being drawn, like so:
-(CGFloat)tableView:(UITableView*)tableViewheightForHeaderInSection:(NSInteger)section{// This is the new important bit for iOS5.if([selfcurrentViewNeedsTableHeaders]){return0;}return45;}// Will produce a green view with a black bottom separator line.-(UIView*)tableView:(UITableView*)tableViewviewForHeaderInSection:(NSInteger)section{if([selfcurrentViewNeedsTableHeaders]){returnnil;}// How wide is the screen?floatw=[[UIScreenmainScreen]bounds].size.width;headerLabel=[[UILabelalloc]initWithFrame:CGRectMake(0.0,0.0,w,44.0)];headerLabel.text=[selftableView:tableViewtitleForHeaderInSection:section];headerLabel.backgroundColor=[UIColorcolorWithRed:0.431green:0.820blue:0.137alpha:1.0];headerView=[[UIViewalloc]initWithFrame:CGRectMake(0,0,w,45)];headerView.backgroundColor=[UIColorblackColor];headerLabel.font=[UIFontboldSystemFontOfSize:15];// Add Label to the headerView's view hierarchy[headerViewaddSubview:headerLabel];returnheaderView;}-(BOOL)currentViewNeedsTableHeaders{return([self.somePropertyisEqualToString:@"parrot"])?FALSE:TRUE;}