uisearchdisplaycontroller

Show UISearchDisplayTableView when search string is empty [duplicate]

你。 提交于 2019-12-06 00:47:44
问题 This question already has answers here : UISearchDisplayController - how to preload searchResultTableView (8 answers) Closed 4 years ago . This is extremely frustrating: I'm trying to display unfiltered results in a UISearchDisplayController even if the search string is empty. Adding debug code to numberOfSectionsInTableView: and numberOfRowsInSection: shows that when my search string is empty, non-zero integers are being returned, but cellForRowAtIndexPath: is never called! The tableview

Hide UITableView search bar

╄→гoц情女王★ 提交于 2019-12-05 21:03:04
I have a UITableViewController with a UISearchDisplayController setup in the standard way (with the search bar inside the tableView). I'd like the search bar to start out hidden - really hidden, not merely scrolled away as in this solution . Then I'd like to present the search UI when the user presses a button, and hide it again (really hide it) after the user selects one of the items found in the search. Here's the almost working code for that: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.searchDisplayController.searchBar.prompt = @"Add an item"; self

How to Search Array of Dictionary and show in UITableview?

。_饼干妹妹 提交于 2019-12-05 16:01:10
I am pretty new in IOS and I am using UISearchDisplayController for searching. -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { [self filterContentForSearchText:searchString scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]]; return YES; } - (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY SELF == %@", searchText]; NSArray

UISearchDisplayController gap between overlay and bar

随声附和 提交于 2019-12-05 14:42:14
In my app I'm trying to add search functionality. I have table view controller and custom top bar view where I show UISearchBar . The problem is that overlay view is always a bit under the top bar and it adds gap between them: In my table view controller .m file's viewDidLoad : [super viewDidLoad]; LSDropdownViewController *menuCtrl = (LSDropdownViewController *)[self parentViewController]; menuCtrl.topSearchBar.delegate = self; [menuCtrl.topSearchBar setBackgroundColor:[UIColor clearColor]]; [menuCtrl.topSearchBar setBackgroundImage:[UIImage imageWithGradientColors]]; [menuCtrl.topSearchBar

Search bar getting hidden by navigation bar when becomes active

╄→гoц情女王★ 提交于 2019-12-05 10:23:22
I am facing a weird scenario, I have used a search bar in my application and tied it up with a table view as is seen in the below image! But when ever I try to search anything the search bar slides up and gets hidden by navigation bar, I have used search bar a number of times and never seen me thing like this below is its screen shot ! I can't remove the navigation bar since I need it, but I just can't figure out why or how it can be happening, One point to note is that the search bar and it's controller are working perfectly when tried to search, only thing is it's getting hidden behind the

How to control the searchResultsTableView of a UISearchDisplayController?

若如初见. 提交于 2019-12-05 06:46:15
I wonder how to take control over the table view that is used by the UISearchDisplayController . You can't overwrite the searchResultsTableView property of the UISearchDisplayController , because it is a read-only property. I've tried to overlay the searchResultsTableView by a custom UITableView . That works just once, but as soon as you try a second search, the real searchResultsTableView is on top again. (I mean, you type in some text in the searchBar , your custom table view is on top and displays the search results, afterwards you press the cancel button. Now, if you repeat this, your

Getting notified when user presses “Search” on keyboard in UISearchDisplayController

允我心安 提交于 2019-12-05 02:37:11
I am using a UISearchDisplayController to let the user search through a list of buildings on a university campus. Sometimes, the user will know exactly what building they want, enter the building's number, and that building will then be the only building result showing in the UITableView. At the moment, if the user proceeds to hit "Search" on the keyboard, the keyboard animates off the screen and the user then has to make a second tap on the sole item in the UITableView to be sent to a point on a map showing the location of that building. My question is, is there a way to be notified when the

SearchBar in Navigation Bar in iOS7

↘锁芯ラ 提交于 2019-12-04 21:26:53
I have a tableview containing all the countries and their flags. I've been working to add a search bar and had it all working until I decided to move the search bar into the navigation bar allowed in iOS7 (for my purposes, that layout works very well). Now, the table loads fine, the search bar shows up fine. As I type into the search bar, I can see the filtered list being built via the console. All looks good, EXCEPT the search results table never displays. In other words, I don't see the filtered list in a new tableview. This method is being called to build the filtered list: -(void

UISearchBar clipped under status bar when added to UISearchDisplayController

柔情痞子 提交于 2019-12-04 19:01:50
问题 I want my search bar to draw its background extended upwards below the status bar like this: This is the corresponding code for the image above: - (void)viewDidLoad { [super viewDidLoad]; self.searchBar = [[UISearchBar alloc] init]; self.searchBar.delegate = self; [self.view addSubview:self.searchBar]; self.searchBar.translatesAutoresizingMaskIntoConstraints = NO; NSDictionary *views = @{@"v":self.searchBar, @"topLayoutGuide":self.topLayoutGuide}; [self.view addConstraints:[NSLayoutConstraint

Random UISearchDisplayController Crash (iOS 7)

对着背影说爱祢 提交于 2019-12-04 15:37:20
I've been trying to fix a crash that around 50% of my users are having. The crash began after I implemented a UISearchDisplayController (ie. added a search bar to a table view), but I haven't been able to reproduce the crash, not even once. According to my users, they instantly crash (or freeze) when they open the table view that has the UISearchDisplayController. According to Crashlytics, the crash is happening at: -[UISearchDisplayController _updateTableHeaderBackgroundViewInTableView:amountScrolledUnder:] I've created the UITableView programmatically, but I've added the UISearchBar