Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to push view controller when I use UISearchController

I have UISearchcontroller. When I select a searched item and try to push a viewcontroller, the viewcontroller is not being pushed. The reason for this issue is when I set self.definespresentationcontext to NO. Its working if I set the self.definespresentationcontext to YES, but the searchbar beomes hidden.

Example :

    self.searchResultController = [[MyResultsController alloc]init];
    self.searchResultController.delegate = self;
    self.searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultController];
    self.searchController.delegate = self;
    self.searchController.hidesNavigationBarDuringPresentation = NO;
    self.searchController.searchBar.delegate = self;
    self.searchController.searchBar.showsCancelButton = YES;
    self.searchController.searchBar.translucent = YES;
    [self.searchController.searchBar sizeToFit];
    self.definesPresentationContext = NO;

Can somebody help me out to solve this issue? Thanks in advance.

like image 867
Sheik_101 Avatar asked Jul 29 '26 16:07

Sheik_101


1 Answers

Maybe

presentingViewController?.navigationController?.pushViewController(eventDetailsViewController, animated: true)

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!