ios 微信通讯录搜索uisearchcontroller 怎么应用的
1个回答
展开全部
只要返回上一个界面就会报这个警告,Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7fe96da6c130>)
但是如果有点了一下搜索框再返回就不会报,这个警告倒是不影响使用,但是看着不爽。。
下面是我的相关的设置
- (void)viewDidLoad {
...
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.tableView.tableHeaderView = self.searchController.searchBar;
self.searchController.searchBar.searchBarStyle = UISearchBarStyleMinimal;
self.searchController.hidesNavigationBarDuringPresentation = NO;
self.definesPresentationContext = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if (self.searchController.active) {
self.searchController.active = NO;
[self.searchController.searchBar removeFromSuperview];
}
但是如果有点了一下搜索框再返回就不会报,这个警告倒是不影响使用,但是看着不爽。。
下面是我的相关的设置
- (void)viewDidLoad {
...
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.tableView.tableHeaderView = self.searchController.searchBar;
self.searchController.searchBar.searchBarStyle = UISearchBarStyleMinimal;
self.searchController.hidesNavigationBarDuringPresentation = NO;
self.definesPresentationContext = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if (self.searchController.active) {
self.searchController.active = NO;
[self.searchController.searchBar removeFromSuperview];
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询