出現(xiàn)的問(wèn)題原因,從一個(gè)控制器modal到一個(gè)帶有搜索控制器,然后從搜索控制器返回的時(shí)候,會(huì)出現(xiàn)這個(gè)警告
Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x154d39700>)
解決辦法:
Objective-C...
-(void)dealloc {
[searchController.view removeFromSuperview]; // It works!
}
Swift 3...
deinit {
self.searchController.view.removeFromSuperview()
}
引用
Attempting to load the view of a view controller while it is deallocating… UISearchController