UISearchController searchBar disappears on first click
This happened to me when the UISearchController
was hiding the navigation bar. Setting this property fixed it:
UISearchController.hidesNavigationBarDuringPresentation = NO;
Try to check the navigationBar.translucent
property - it should be YES when UISearchController
will present the searchBar
or else will be UI bugs.
Update from @SiavA
The better solution is use the extendedLayoutIncludesOpaqueBars
property of the UIViewController
. If you using the opaque navigation bar just set it in the true
for controller which will be show UISearchController
(not for navigationController
).
E.g.
- (void)viewDidLoad {
[super viewDidLoad];
self.extendedLayoutIncludesOpaqueBars = !self.navigationController.navigationBar.translucent;
}