uisearchcontroller

Position UISearchBar programmatically using UISearchController

僤鯓⒐⒋嵵緔 提交于 2019-12-06 17:27:20
I'm attempting to position my UISearchBar directly under my UINavigationBar but I'm having issues where it's not appearing at all. I'm using iOS8's new searchController. self.searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController]; self.searchController.searchResultsUpdater = self; self.searchController.searchBar.frame = CGRectMake(self.searchController.searchBar.frame.origin.x, self.searchController.searchBar.frame.origin.y, self.searchController.searchBar.frame.size.width, 44.0); self.salesTableView.tableHeaderView = self.searchController

Searching a UITableView and ignoring punctuation

一笑奈何 提交于 2019-12-06 16:26:33
问题 Is there a way to search through a UITableView and ignore certain characters like commas or dots? I.e. I would like to search for "St George" but my data set contains "St. George" so the result is always zero. EDITED Q: func filteredArray(searchText: NSString) { if searchText == "" { array_search = array_all } else { showTableViewResults() array_search.removeAll() for i in 0 ..< array_all.count { let object:MyObject = array_all[i] let languageSearchString = object.myObjectName let searchStr

How do I create a UISearchController since UISearchDisplayController is deprecated in iOS 8?

无人久伴 提交于 2019-12-06 15:03:24
There is NO UISearchController in IB, only the UISearchDisplayController; where do I find docs on creating it? From documentation; Important: UISearchDisplayController is deprecated in iOS 8. (Note that UISearchDisplayDelegate is also deprecated.) To manage the presentation of a search bar and display search results in iOS 8 and later, instead use UISearchController . Read UISearchController documentation. There is an example how to create UISearchController , not in IB but programmatically. 来源: https://stackoverflow.com/questions/33711358/how-do-i-create-a-uisearchcontroller-since

Display table view when searchBar (from searchController) begin edited Swift

左心房为你撑大大i 提交于 2019-12-06 13:53:40
问题 I already seen this question : How to show tableview when user taps searchbar swift It's the same issue as me but when I use the answer it can't work for me. When I click on the button search, only the searchbar appears on the search controller then if I type something the tableView doesn't appear at all. I use Swift 3. The best example for what I want to do is the Instagram search function. When user tap the searchbar a tableView comes as a subView. I show you my current code of my

Accessing index path row after search

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 12:46:49
I populate a table with data and all works as intended - including segueing each row's details to another scene. I throw a search bar in there (programmatically - using the new searchController) and it successfully reloads the original table with any found results. HOWEVER, when touching a selected row after a search, the segue passed along is that of the original table row that happens to be in the same position of the one touched now! (i.e. if I choose the current second row of a search, the next scene will segue the details of the second row of the original table!) So how do I provide the

UISearchcontroller searchbar delegate not working

走远了吗. 提交于 2019-12-06 10:59:50
class PlaceSelectorViewController: UIViewController, GMSAutocompleteResultsViewControllerDelegate, UISearchBarDelegate { I have included searchbar delegate searchController?.searchBar.delegate = self and I have set the delegate. But method func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { stopHighlight() } doesn't happen. Delegate has set properly and stopHighlight() is a real function Make delegate of searchbar in viewdidload method. override func viewDidLoad() { super.viewDidLoad() searchBarCustom.delegate = self } or you can set it in storyboard as -hence delegates will call as

Search Controller with multiple section in UITableView

与世无争的帅哥 提交于 2019-12-06 07:55:06
问题 I have a UIViewController in which I have a UITableView and inside that tableview I have multiple sections which have some item and I have to search with itemname inside that tableview. I have declared this in my view controller let searchController = UISearchController(searchResultsController: nil) override func viewDidLoad() { super.viewDidLoad() searchController.dimsBackgroundDuringPresentation = false definesPresentationContext = true tableView.tableHeaderView = searchController.searchBar

Strange white space at UITableView header when using UISearchController with UITableViewController on iOS 10

戏子无情 提交于 2019-12-06 06:11:12
问题 The white space only appears on iOS 10. 回答1: I ran into this problem as well. If you have the vertical scroll indicator enabled, you should be able to see that it's a UIScrollView 's inset issue. And seems like it only happens when you use a UITableViewcontroller as the searchResultsController of a UISearchController . And this extra space is visible at both the top and bottom of the view. This answer is not pretty, but I'm adding this in for now. if #available(iOS 10.0, *) {

How do you reference to a UISearchController using Storyboards

房东的猫 提交于 2019-12-06 03:47:19
问题 I've added a Search Bar & Search Display Controller (assuming that's what I add in storyboard since theirs no 'SearchController' object to drag out). My issue is how do I set properties on that SearchController now? self.searchController doesn't work and Xcode says it's automatically added when I add the UISearchBar to the view. What am I doing wrong? The reason I need access it is so I can set the results search table, like so: UITableViewController *searchResultsController = [

Wrong placement of search text field inside search bar on iOS 11

倖福魔咒の 提交于 2019-12-05 23:17:34
I am using UISearchController as part of navigation bar using the new APIs introduced in iOS 11. I am using it in the following manner in my ViewController's viewDidLoad - (void)viewDidLoad { [super viewDidLoad]; [_table setDataSource:self]; [_table setDelegate:self]; searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; [self.navigationItem setSearchController:searchController]; [self.navigationItem setHidesSearchBarWhenScrolling:NO]; [searchController.searchBar setBackgroundColor:[UIColor greenColor]]; } However, the search text field is rendered at the wrong