我有UISearchcontroller
。当我选择搜索到的项目并尝试推送viewcontroller
时,viewcontroller
未被推送。这个问题的原因是我将self.definespresentationcontext
设置为NO
。如果我将self.definespresentationcontext
设置为YES
,但搜索栏可以隐藏,则可以正常工作。
示例:
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;
有人可以帮助我解决这个问题吗? 提前谢谢。