uisearchcontroller

Change UISearchBar cancel button text in iOS 8

末鹿安然 提交于 2020-01-10 06:59:05
问题 I'd like to change the text from ¨Cancel¨to ¨Done¨ of the Cancel button inside the UISearchBar in iOS 8. I am using UISearchController. I've tried different approaches for iOS 6 and iOS 7 and they do not work. Has anybody done this? 回答1: Objective-C: [searchBar setValue:@"customString" forKey:@"_cancelButtonText"]; Swift: searchBar.setValue("customString", forKey:"_cancelButtonText") 回答2: This worked for me in ios8, did not try in ios7, but should do the trick, beware of placing this line in

Custom scope buttons

£可爱£侵袭症+ 提交于 2020-01-07 05:25:27
问题 I'm trying to create custom scope buttons, but i'm having trouble actually linking them to my buttons. This is what I have extension HomeViewController: UISearchResultsUpdating { func updateSearchResults(for searchController: UISearchController) { let searchBar = searchController.searchBar let scope = titles[searchBar.selectedScopeButtonIndex] filterContentForSearchText(searchText: searchController.searchBar.text!, scope: scope) } } extension HomeViewController: UISearchBarDelegate { func

UISplitViewController with new UISearchController issue with UISearchBar

∥☆過路亽.° 提交于 2020-01-07 04:01:50
问题 I recently started to rewrite my iOS app to use the new UISearchController and a universal storyboard. My app is available for both devices ( iPhone and iPad ) so the change to the universal storyboard using the UISplitViewController was a big advantage. But sadly the UISearchController isn't working as expected. I added the UISearchController with the following lines: self.searchController = UISearchController(searchResultsController: nil) self.searchController.searchBar.sizeToFit() self

UINavigationBar turns white and won't close when using navigationItem.searchController in iOS 13

北城以北 提交于 2020-01-06 08:13:01
问题 I am having trouble using navigationItem.searchController in iOS 13. The search bar of the search controller is initially closed, but it won't collapse back after I scroll the table view. It 'bounces' back when I try to hide the bar. Also, the navigation bar turns white after the search bar appears. (The navigation bar has a custom tint color; see the attached screenshots.) Note that this wasn't the case in iOS < 13. Is this a bug in iOS 13? If it is, is there a work around to keep the tint

UINavigationBar turns white and won't close when using navigationItem.searchController in iOS 13

自闭症网瘾萝莉.ら 提交于 2020-01-06 08:12:35
问题 I am having trouble using navigationItem.searchController in iOS 13. The search bar of the search controller is initially closed, but it won't collapse back after I scroll the table view. It 'bounces' back when I try to hide the bar. Also, the navigation bar turns white after the search bar appears. (The navigation bar has a custom tint color; see the attached screenshots.) Note that this wasn't the case in iOS < 13. Is this a bug in iOS 13? If it is, is there a work around to keep the tint

UISearchController - Keyboard not showing

允我心安 提交于 2020-01-04 21:31:21
问题 I am using the UISearchController and the search function works except for two things. Perhaps they are related: a) The keyboard does not show. So I cannot press the "Search" button b) In my main TableView I access the prototype cell that has the style "Subtitle". When the search is going on, the cell that shows is "Basic" style. In both cases (TableViewController and SearchViewController) I use the same cell identifier. Any ideas? Here some of the code: class OverviewTableViewController:

Warning: Attempt to present View Controller on * which is already presenting <UISearchController: 0x142a1f7c0>

北城余情 提交于 2020-01-03 17:31:15
问题 I made a view controller with a UISearchController and a UITableView . There are two different kind of search you can select from the search scope buttons : groups and people. Both searches work and show results on the table. However, if you click on each cell they should direct you to different dynamic pages (a dynamic group page or a dynamic person profile page). The one for groups works, while the one for profiles doesn't. Meaning whenever I click on the a person cell from the results that

UISearchbar (UISearchResultsUpdating) with Segue does not dismiss

坚强是说给别人听的谎言 提交于 2020-01-03 16:51:14
问题 I have a problem with a UISearchBar . When I search some Text in combination with an UITableView , and ill click on one result Cell, the UISearchBar is still visible in the next UIViewController . the UISearchbar is still there (with the Keyword) So after ill click on one result, ill get (in the next View Controller)but the searchbar and keyboard is still showing. how can i dismiss the current UISearchController so that the search bar and keyboard do not show in the next UIViewController ? I

Search Bar disappeared from view while typing

北慕城南 提交于 2020-01-02 10:14:45
问题 I added SearchBar to my TableView in ViewDidLoad() doing it: self.searchBar = UISearchController(searchResultsController: nil) self.searchBar.searchResultsUpdater = self self.searchBar.dimsBackgroundDuringPresentation = false self.searchBar.searchBar.sizeToFit() self.tableView.tableHeaderView = self.searchBar.searchBar self.tableView.reloadData() everything works fine, but when I tap on this SearchBar it disappears. It means, I can still typing, and I can see the results but, don't see

iOS 13 UIBarButtonItem not clickable and overlapping UINavigationBars when using UISearchController

孤街醉人 提交于 2019-12-28 02:33:05
问题 I got a navigation bar containing some UIBarButtonItem buttons and a UISearchBar hooked up like this var searchController: UISearchController! override func viewDidLoad() { super.viewDidLoad() title = "Test" tableView.delegate = self tableView.dataSource = self searchController = UISearchController(searchResultsController: nil) navigationItem.searchController = searchController // This leads to the bug searchController.hidesNavigationBarDuringPresentation = false navigationItem