I have a search bar as a title view for my navigation bar.
And it looks like this, the way I want it to look like:
But when I tap on it, it just slides to top and becomes inaccessible
Here is the code I used to configure it:
- (void)configureSearchBar
{
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchBar.delegate = self;
self.navigationItem.titleView = self.searchController.searchBar;
}
Is there any way to fix this kind of problem?
self.searchController.hidesNavigationBarDuringPresentation = NO
Adding this line has solved this problem or me. The reason of this problem was that my search bar was set as a title view for my navigation bar and the property hidesNavigationBarDuringPresentation
was set to YES
by default. Setting this property to NO
solves this kind of problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.