iOS 9 searchBar disappears from table header view when UISearchController is active

后端 未结 13 1288
無奈伤痛
無奈伤痛 2020-12-07 20:37

The structure:

View1 (click a button) -> present modally (MyModalView: UITableViewController)

MyModalView has UISearchController embedded. The searchBar of U

13条回答
  •  隐瞒了意图╮
    2020-12-07 21:08

    I'm not sure what exactly is the problem but I 'fixed' it by:

    self.searchController.hidesNavigationBarDuringPresentation = NO;
    self.definesPresentationContext = NO;
    

    My guess is that UISearchController is doing something funky when it is trying to present as a navigation bar. So, this is a hack but it at least doesn't block the user. The search bar doesn't do the cool animation and cover up the navigation bar.

提交回复
热议问题