uisearchdisplaycontroller

How do I use the UISearchBar and UISearchDisplayController

这一生的挚爱 提交于 2019-11-27 10:53:17
I have an app which displays quite a lot of data in a UITableView . I already added the UISearchBar and UISearchDisplayController in Interface Builder to the UITableView . But I do not know how to use it. If someone could provide a quick solution to this, I would be grateful. I just require it to work as you type to find matches of the search query in the UITableView cells (or from an array). UPDATE 1 : Here's the code from the numberOfRowsInSection method: -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (isSearching) { return [searchResults count];

iOS 7 UISearchDisplayController search bar overlaps status bar while searching

人盡茶涼 提交于 2019-11-27 10:16:07
I'm updating my app for iOS 7, and I'm in the process of adjusting all my views to account for the new transparent status bar (my app will still use opaque navigation bars). It was relatively easy to adjust for the status bar in every view, except one major problem I'm having with a UISearchBar connected to a UISearchDisplayController in one of my view controllers. The search bar seems to display normally, as shown below: Search Bar http://imageshack.us/a/img163/9128/06vx.png The problem is, as soon as I begin searching, the navigation bar disappears (as it should), but everything else also

searchDisplayController deprecated in iOS 8

你说的曾经没有我的故事 提交于 2019-11-27 09:11:48
How do you correct the following so no warnings appear? What am I missing? When correcting the searchResultsController to searchController it gives me an error "object not found" if (tableView == self.searchDisplayController.searchResultsTableView) { cell.textLabel.text = [searchResults objectAtIndex:indexPath.row]; } else { cell.textLabel.text = [_content objectAtIndex:indexPath.row]; } return cell; } -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { [self filterContentForSearchText:searchString scope:[[self

Cursor invisible in UISearchBar iOS 7

守給你的承諾、 提交于 2019-11-27 07:37:31
问题 I have UISearchBar in UITableView as a table header. When I push the UISearchBar for start searching, this method is being triggered - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar for UISearchDisplayController . But result is like that; As you can see, there is no cursor, I can start typing and search, everything works fine. Also it's invisible only in iOS 7. However, with iOS 6.1 and iOS 7.1 Beta 3 I could see the cursor. So how can I make UISearchBar cursor visible or how can

ios 5 UISearchDisplayController crash

孤者浪人 提交于 2019-11-27 05:42:22
问题 I am implementing a UITableView with UISearchDisplayController in xcode 4.2. UITableView & UISearchDisplayController are created in StoryBoard. I set the Cell Identifier (SampleCell) for UITableView and access it like cell = [tableView dequeueReusableCellWithIdentifier:@"SampleCell"]; UItableView is working fine. But once i try to search, the app crash with below error. *** Assertion failure in -[UISearchResultsTableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim

iOS - using UISearchDisplayController with UISearchBar that is UIBarButtonItem in UIToolbar

大城市里の小女人 提交于 2019-11-27 03:31:54
问题 Has anyone tried using a UISearchDisplayController with a UISearchBar that is a UIBarButtonItem in a UIToolbar? I would appreciate tips on how to do this successfully. Currently whenever the search controller pops up it redraws the UISearchBar and I'm struggling to maintain a similar look to the UIToolbar 回答1: Usually you don't want to put a search bar inside a toolbar, however, it seems you want to do something similar to what I did. So here is how I did it, it may be called a hack, but it

Displaying search bar in navigation bar in iOS 8

☆樱花仙子☆ 提交于 2019-11-27 03:21:10
UISearchDisplayController had a boolean property called displaysSearchBarInNavigationBar . What's the equivalent in iOS 8 to have my search bar move up there? Any guidance is greatly appreciated. Here's my code, I'm not entirely sure why this isn't working. When I click the search bar, it just disappears instead of moving itself and the navigation bar up. import UIKit class ViewController: UIViewController, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource { let searchController = UISearchController(searchResultsController: nil

UISearchDisplayController - how to preload searchResultTableView

百般思念 提交于 2019-11-27 01:05:38
问题 I want to show some default content when the user taps the Searchbar, but before any text is entered. I have a solution working using settext: - (void) searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller { [searchDisplayController.searchBar setText:@" "]; } This works but it's not elegant and the hint text in the Searchbar disappears. Is there a better way to preload data to the SearchResultTableView in a UISearchDisplayController, without having to implement the

UISearchDisplayController's searchResultsTableView's ContentSize is incorrect. Bug in iOS 7?

╄→гoц情女王★ 提交于 2019-11-27 00:10:16
问题 The below problem only occurs on an iOS 6.0/6.1 application running on an iOS 7.0+ device. So I have a UISearchDisplayController that searches our API and returns data. This all works, and everything is displayed as we want. The only problem we are seeing is that after the content has populated the searchResultsTableView , it seems as though when the keyboard is initially hidden, the contentSize of the searchResultsTableView is much larger than the data, and actually seems to be the size of

Search Bar and Search Display Controller in table view

一曲冷凌霜 提交于 2019-11-26 16:38:40
问题 I have tried to implement a search bar but I have not had any luck dealing with this problem. I would really appreciate any help that can be provided. I've a big project in which I've a table view, and I want to implement a search bar over it and see the real time filtering. I do not use Storyboard but I'm using XIB. I've added the following protocols: <UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UISearchDisplayDelegate> I've declared 2 arrays in @interface , the first for