Tag: uisearchcontroller

UISearchController在继续之后保持

我有一个UISearchController的应用程序。 用户界面的这个元素完全是这样设置的: searchController = UISearchController(searchResultsController: nil) searchController.searchResultsUpdater = self searchController.searchBar.delegate = self searchController.dimsBackgroundDuringPresentation = false searchController.hidesNavigationBarDuringPresentation = false searchController.searchBar.searchBarStyle = UISearchBarStyle.Minimal searchController.searchBar.frame = CGRectMake(searchController.searchBar.frame.origin.x, searchController.searchBar.frame.origin.y, searchController.searchBar.frame.size.width, 44.0) 然后我把它添加到我的tableView的tableHeaderView tableView.tableHeaderView = searchController.searchBar 一切似乎工作正常,但是当它是活跃的,我在我的tableView中select一个项目,我的应用程序继续到另一个视图控制器的search控制器坚持视图。 我不确定如何这是可能的,因为search控制器应该是另一个视图控制器中的表视图的子视图。 我怎样才能防止这种情况发生?

如何在UITableView中实现UISearchController – Swift

我是Swift的新手,我试图添加searchfunction,我的UITableView是在UIViewController类。 我GOOGLE了很多,发现UISearchDisplayController已被弃用,并由UISearchController取代。 当我试图寻找教程,我没有find任何具体的UITableView 。 其中一些是在UITableViewController实现的。 所以这是我的问题: 我们可以在UIViewController类的UITableView中实现UISearchController吗? (我想我们可以) 如果可以的话,请转换Objective-C中编写的这些代码行。 或者如果有一些非常好的教程,请让我知道。 @property (strong, nonatomic) UISearchController *searchController; UITableViewController *searchResultsController = [[UITableViewController alloc] init]; // Init UISearchController with the search results controller self.searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController]; // Link the search controller self.searchController.searchResultsUpdater = self; 资源 编辑:我想分配search结果更新在 class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchResultsUpdating { override func viewDidLoad() { […]