1
Mon application semble se bloquer chaque fois que je sélectionne une ligne de table alors que mon contrôleur de recherche est actif.L'application se bloque lors de la sélection de la ligne du tableau pendant que le contrôleur de recherche est actif
choses à noter:
- Mon contrôleur de recherche est intégré dans ma tête de table
- J'ai actuellement une solution, cependant, il faut mon contrôleur de recherche être rejeté lorsque la ligne de table sélectionnée. Cela rend l'expérience de l'interface utilisateur médiocre. Je ne veux pas avoir à rejeter mon contrôleur de recherche
Voici une partie de mon code:
class ViewProfileViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource, UISearchBarDelegate, UISearchResultsUpdating {
let searchController = UISearchController(searchResultsController: nil)
override func viewDidLoad() {
super.viewDidLoad()
searchController.searchResultsUpdater = self
searchController.hidesNavigationBarDuringPresentation = false
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.sizeToFit()
searchController.searchBar.searchBarStyle = .minimal
searchController.searchBar.placeholder = "Search City"
searchController.searchBar.showsCancelButton = true
searchController.searchBar.delegate = self
searchController.searchBar.backgroundColor = UIColor.white
self.myTable.tableHeaderView = searchController.searchBar
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if searchController.isActive {
navigationController?.popViewController(animated: true)
dismiss(animated: true, completion: nil)
} else {
}
let mViewController = MController()
let navController = UINavigationController(rootViewController: mViewController)
present(navController,animated: true, completion: nil)
}
}
Est-il possible de présenter mon CV sans rejeter ma SearchController? ou à tout le moins puis-je garder mon texte de recherche dans mon contrôleur de recherche? – ajayb