Iphone 增加TableView标题的大小
使用故事板,我制作了以下Iphone 增加TableView标题的大小,iphone,ios,uitableview,uisearchbar,Iphone,Ios,Uitableview,Uisearchbar,使用故事板,我制作了以下UITableViewController: 好的,当我开始搜索时,在搜索栏shouldbeginediting:中,我将隐藏导航栏并显示范围栏: - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { [self.mySearchBar setShowsScopeBar:YES]; [self.mySearchBar sizeToFit]; [self.mySearchBar
UITableViewController
:
好的,当我开始搜索时,在搜索栏shouldbeginediting:
中,我将隐藏导航栏并显示范围栏:
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
[self.mySearchBar setShowsScopeBar:YES];
[self.mySearchBar sizeToFit];
[self.mySearchBar setShowsCancelButton:YES animated:YES];
[self.navigationController setNavigationBarHidden:YES animated:YES];
return YES;
}
但表的第一个单元格隐藏在范围栏后面。我想我需要增加表格标题,但是我怎么做呢?或者有其他方法来修复它?UITableViewDelegate有一个方法可以执行此操作:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
//return height as a float here
}
以适当的高度在学员身上实现这一点
或者,如果条形图隐藏了单元格的顶部,则可能需要在屏幕上向下移动表格视图,方法是更改其框架,如下所示:
CGRect newFrame = tableView.frame;
newFrame.origin.y += 45; //or whatever number of pixels you want to move it down by
tableView.frame = newFrame;
在回答我自己的问题时,再看一看,我发现了一个似乎最正确的解决方案,那就是使用
UISearchDisplayController
。以下是我遵循的教程:
使用这种方式,他隐藏导航栏并显示范围,而不需要额外的代码,也不存在隐藏第一个单元格的问题