Prevent a UISearchDisplayController from hiding the navigation bar

后端 未结 15 1635
南方客
南方客 2020-11-27 11:59

Whenever a user begins editing a UISearchDisplayController\'s search bar, the search controller becomes active and hides the view\'s navigation bar while presen

15条回答
  •  长情又很酷
    2020-11-27 12:13

    The above answers didn't work quite right for me. My solution is to fool the UISearchDisplayController into thinking there wasn't a UINavigationController.

    In your view controller, add this method

    - (UINavigationController *)navigationController {
        return nil;
    }
    

    This had no untoward side effects for me, despite seeming like a really bad idea... If you need to get at the navigation controller, use [super navigationController].

提交回复
热议问题