【问题标题】:UISearchControll Searchbar Doesn't Animate into UINavigationBarUISearchControll 搜索栏不动画到 UINavigationBar
【发布时间】:2015-07-02 18:35:24
【问题描述】:

我在 tableview.tableHeaderView 中有一个 uisearchcontroller 搜索栏。但是,当我单击搜索栏时,它不会在搜索栏中设置动画,而是停留在原来的位置。我已经尝试了所有方法,但我无法理解为什么这在 iOS8 中会有所不同。非常感谢任何帮助!!!!

是的,导航栏是 uinavigationcontroller 的一部分

代码如下:

drinksSC = [[UISearchController alloc]initWithSearchResultsController:nil];
drinksSC.searchResultsUpdater = self;
drinksSC.dimsBackgroundDuringPresentation = NO;
drinksSC.searchBar.delegate = self;
drinksSC.hidesNavigationBarDuringPresentation = NO;
drinksSC.searchBar.searchBarStyle = UISearchBarStyleMinimal;
[drinksSC.searchBar sizeToFit];
self.tableView.tableHeaderView = drinksSC.searchBar;
self.definesPresentationContext = YES;

【问题讨论】:

    标签: ios8 uinavigationbar uisearchcontroller


    【解决方案1】:

    drinksSC.hidesNavigationBarDuringPresentation的值改为YES,就可以了。

    或者完全删除这一行,因为这个属性的默认值是YES

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-29
      • 2021-02-22
      • 2018-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多