使用Xcode 3.26和SDK 4.3进行编译,我有一个带有搜索字段的表格,下面是一个在搜索后进入视图的部分标题。表明它是一个搜索表。标题是绿色的,只是说“结果”。如果没有搜索它是不可见的。
现在使用Xcode 4.1.1和SDK 5.1编译相同的代码,标题在搜索后的工作方式相同,但即使不搜索也始终可见。变为灰色并始终浮动在导航栏下方的桌面上。
我该怎么办?喜欢它以前的方式。
代码是这样的。
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection: (NSInteger)section{if(tableView == self.searchDisplayController.searchResultsTableView)
{ UILabel *tempHeaderLabel=[[UILabel alloc]initWithFrame:CGRectMake(0,0,320,30)];
tempHeaderLabel.backgroundColor=[UIColor colorWithRed:67.0/255.0 green:126.0/255.0 blue:71.0/255.0 alpha:1.0];
tempHeaderLabel.textColor=[UIColor colorWithRed:227.0/255.0 green:227.0/255.0 blue:227.0/255.0 alpha:1.0];
tempHeaderLabel.font = [UIFont fontWithName:@"Georgia-BoldItalic" size:16];
tempHeaderLabel.text=@" Result";
return tempHeaderLabel;
}
else
return nil;
}