uisearchbardelegate

Where does filterContentForSearchText:scope: method come from?

心不动则不痛 提交于 2020-01-14 02:36:08
问题 Recently, I noticed that filterContentForSearchText:scope: appeared in multiple tutorials regarding how to implement a search bar. However, I looked up the references of both UISearchDisplayDelegate and UISearchBarDelegate . I found this filterContentForSearchText:scope: is neither a required nor an optional method. I wondered if filterContentForSearchText:scope: is just a conventional method name for filtering search results? 回答1: Yes, that is only convention for a common method called from

Can't make table view inactive when search bar is in use. iPhone

折月煮酒 提交于 2019-12-24 09:15:16
问题 I have a table view with a search bar above it, and when the search bar is pressed I want the table view to become inactive. So I have this method: - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { self.tableView.userInteractionEnabled = NO; } with the same class being the UISearchBarDelegate. For some reason though it doesn't disable the table view. Any thoughts? Let me know if there's any other pieces of code needed to help. Thanks. 回答1: Not sure why userInteractionEnabled is

Double tap UISearchBar with search delegate on iOS 7 causes UISearchBar to disappear

£可爱£侵袭症+ 提交于 2019-12-21 04:51:42
问题 We have a search bar in the table header. When the user taps on it twice quickly on iOS 7, it disappears. Does anyone have any suggestions what we are doing wrong? 回答1: After lots of trial and errors, I found that when searchDisplayController ends search, searchbar gets disappear, so I have reinserted the searchbar to table header and it worked for me. - (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller { self.searchingFetchedResultsController = nil; if (floor

filterContentForSearchText and shouldReloadTableForSearchString not called (UITableView & UISearchBar)

陌路散爱 提交于 2019-12-20 03:12:30
问题 I'd like to implement an incremental search of words. I implemented like below, but filterContentForSearchText and shouldReloadTableForSearchString methods are not called. Why? WordsIndexViewController.h #import <UIKit/UIKit.h> @interface WordsIndexViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchDisplayDelegate, UISearchBarDelegate> @end WordsIndexViewController.m #import "WordsIndexViewController.h" #import "WordsShowViewController.h" #import "Word.h"

How to make keyboard dismiss when i press out of searchbar on Swift?

天大地大妈咪最大 提交于 2019-12-17 22:37:57
问题 I try to make my searchbar on swift, but i have a problem to dismiss keyboard on screen when i pressed out of searchbar. When i try with textfield it work perfectly fine with this code. override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { self.view.endEditing(true) } It work when i press out of my textfield and then the keyboard is gone. I want to make like that with my searchbar, because when i use searchbar and use the same way like textfield, it doesn't work at all. Any

How to add a searchBar with scopebar inside of a NavigationBar where the navBar automatically increase its height and shows the scopeBar

夙愿已清 提交于 2019-12-12 04:45:18
问题 I read all questions on stackoverflow but none of them could solve my problem. I created a UICollectionView and and anchored a searchBar inside of the navigationBar without using Storyboards! class UserSearchController: UICollectionViewController ,.. {.. lazy var searchBar: UISearchBar = { let sb = UISearchBar() sb.placeholder = "Enter username" sb.barTintColor = UIColor.gray UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).backgroundColor = UIColor.rgb(red: 230, green:

How do you hide/show UISearchBar's scope bar with animation?

梦想的初衷 提交于 2019-12-09 07:59:09
问题 I want to show no scope bar when the table is empty (before the search bar edits for the first time), no scope bar when it's editing, and finally show it when editing done. I know about the UISearchBarDelegate protocol, but I don't know how to show/hide the scope bar with animation. I know UISearchBar has setShowsScopeBar: , but no setShowsScopeBar:animated: the way it does for setShowsCancelButton:animated . Edit It's important that to call [searchBar sizeToFit] after showing/hiding the

UISearchBar implemented with Storyboards

落花浮王杯 提交于 2019-12-07 20:36:57
问题 I am very new to iOS development, very excited though. I have built an app the uses storyboards and populates a UITableView with the contents of a plist file. I managed to get everything running great so far, but now I want to add a search bar much like the one in the contacts app (essentially that's what my app is, just filled with a company directory). I keep reading here and there that there is a very simple way to do this by setting the delegate and data source for the searchbar, but I

UISearchBar implemented with Storyboards

若如初见. 提交于 2019-12-06 15:24:44
I am very new to iOS development, very excited though. I have built an app the uses storyboards and populates a UITableView with the contents of a plist file. I managed to get everything running great so far, but now I want to add a search bar much like the one in the contacts app (essentially that's what my app is, just filled with a company directory). I keep reading here and there that there is a very simple way to do this by setting the delegate and data source for the searchbar, but I have not been able to find any tutorials that demonstrates this with storyboards. It may sound silly but

Where does filterContentForSearchText:scope: method come from?

柔情痞子 提交于 2019-12-06 05:36:02
Recently, I noticed that filterContentForSearchText:scope: appeared in multiple tutorials regarding how to implement a search bar. However, I looked up the references of both UISearchDisplayDelegate and UISearchBarDelegate . I found this filterContentForSearchText:scope: is neither a required nor an optional method. I wondered if filterContentForSearchText:scope: is just a conventional method name for filtering search results? Yes, that is only convention for a common method called from the UISearchDisplayDelegate methods - (BOOL)searchDisplayController:(UISearchDisplayController *)controller