【发布时间】:2012-06-27 13:09:03
【问题描述】:
我遇到了 uisearchdisplaycontroller 的问题。 如果我将控制器的搜索栏添加到 tableviews headerview 它会在搜索栏上方显示一条细白线!如果我在没有搜索控制器的情况下添加搜索栏,它会正确显示。重要的是你要仔细查看标准的搜索显示控制器或对其进行一些自定义,否则你将无法看到这条线。
有人知道避开白线的方法吗?
BaseViewController 的 init 方法中的代码:UIViewController
searchBar = [[UISearchBar alloc] initWithFrame:CGRectZero];
[searchBar sizeToFit];
searchBar.showsCancelButton = NO;
searchBar.barStyle = UIBarStyleDefault;
searchBar.hidden = NO;
searchBar.delegate = self;
searchBar.placeholder = @"Suche";
searchCtrl = [[UISearchDisplayController alloc]
initWithSearchBar:searchBar contentsController:self];
searchCtrl.delegate = self;
searchCtrl.searchResultsDataSource = self;
searchCtrl.searchResultsDelegate = self;
[searchCtrl searchResultsTableView].scrollsToTop = NO;
StartViewController 中的代码:viewWillAppear 中的 BaseViewController
tableController.tableView.tableHeaderView = searchCtrl.searchBar;
searchBar.hidden = NO;
if ( [tableController.tableView contentOffset].y == 0.0 )
{
[tableController.tableView setContentOffset:CGPointMake(0.0, 44.0) animated:NO];
}
没什么特别的,对我来说它与 UISearchDisplayController 无关,因为如果你只使用搜索栏一切都很好
【问题讨论】:
-
也许你应该粘贴一些代码..
标签: iphone uikit uisearchdisplaycontroller