【发布时间】:2016-01-29 22:51:10
【问题描述】:
我希望 uisearchcontroller 在我在搜索栏中输入至少三个字符后开始搜索。那么,我该怎么做呢?
func configureSearchController() {
// Initialize and perform a minimum configuration to the search controller.
searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.placeholder = "Search"
searchController.searchBar.delegate = self
searchController.searchBar.sizeToFit()
let textFieldInsideSearchBar = searchController.searchBar.valueForKey("searchField") as! UITextField
textFieldInsideSearchBar.font = UIFont(name: "Bauhaus", size: 19)
searchController.searchBar.setImage(UIImage(named: "searchikon"), forSearchBarIcon: UISearchBarIcon.Search, state: UIControlState.Normal);
// Place the search bar view to the tableview headerview.
TableView.tableHeaderView = searchController.searchBar
【问题讨论】:
-
这个 obj-c 解决方案可能会有所帮助:stackoverflow.com/questions/9721668/…
标签: ios swift uisearchdisplaycontroller