UISearchBar消失在UINavigationBar
问题描述:
我已经设置了我的UISearchBar(使用UISearchController)iOS8标准,并且我将它以编程方式添加到我的UITableView上方的UIViewController(相信这是目前为iOS8做的唯一方法)像这样在我viewDidLoad中(不像它们添加在他们的TableView头所有其他教程),我想我的滚动我的UITableView时坚持:UISearchBar消失在UINavigationBar
self.automaticallyAdjustsScrollViewInsets = NO;
UITableViewController *searchResultsController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
searchResultsController.tableView.dataSource = self;
searchResultsController.tableView.delegate = self;
CGRect frame = [[UIScreen mainScreen] applicationFrame];
CGSize size = frame.size;
self.searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController];
self.searchController.searchResultsUpdater = self;
self.searchController.searchBar.frame = CGRectMake(0, 60, size.width, 44.0);
self.definesPresentationContext = YES;
[self.view addSubview:self.searchController.searchBar];
我遇到的问题是,当我点击我的搜索领域它通过向上转换消失在我的UINavigationBar后面,如果在UITableView的标题中通常不会发生。
无论如何阻止这种情况发生?谢谢!
这个问题在这里回答: http://stackoverflow.com/a/14798981/4114683 – TheSD 2014-10-29 22:29:50
这与iOS7不相关iOS8 – Joey 2014-10-29 23:09:53
@Joey请针对iOS8特定问题使用[tag:ios8]标签。 (我重申了你的问题。) – Substantial 2014-11-06 00:59:00