uisearchdisplaycontroller

UISearchDisplayController and UITableView prototype cell crash

风格不统一 提交于 2019-11-30 08:22:51
I have a UIViewController setup in a storyboard with a tableview and UISearchDisplayController . I am trying to use a custom prototype cell from self.tableview (which is connected to main tableview in the storyboard). It works fine if self.tableview had returned at least 1 cell when I load my view, but if self.tableview doesn't load a cell (as there is no data), and I load up the UISearchBar and search, the cellForRowAtIndexPath: method crashes: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomSearchCell *cell = [self.tableView

How do I cover the “no results” text in UISearchDisplayController's searchResultTableView?

旧城冷巷雨未停 提交于 2019-11-30 05:44:37
I don't want to show the "no results" text while my server is processing a search query. I figured out the exact coordinates of the table cell that contains the label and attempted to cover it. self.noResultsCoverView = [[[UIView alloc] initWithFrame:CGRectMake( 0.0, 44.0, 320.0, 43.0 )] autorelease]; self.noResultsCoverView.backgroundColor = [UIColor whiteColor]; [self.searchDisplayController.searchResultsTableView addSubview:self.noResultsCoverView]; To my chagrin, my cover was above the table view, but below the label. I need the cover to be above the label. searchResultsTableView:

iOS 7 UISearchDisplayController search bar disappears

落花浮王杯 提交于 2019-11-30 05:09:44
I was recently updating my app and came across this issue. When i start typing in the search bar the search bar disappears and i can only see the table view. I can still keep on typing and the table view gets updated but i cannot see the search bar. Same settings works fine on iOS < 7 Any idea why this is happening ? A little late, but I've encounter the same problem just recently. I wanted the search bar to be visible and active through all of the search, so the dimmed view, which overlaid it, was a big problem. For me the only thing that worked was changing the frame of the dimmed view

Hide UISearchBar Cancel Button

两盒软妹~` 提交于 2019-11-30 00:37:32
I have a UISearchDisplayController and UISearchBar hooked up to my ViewController via Outlets from my nib. I'd like to hide the cancel button so that the user never sees it. The problem is that the following code hides the button, but only after displaying it to the user for a millisecond (e.g., it flashes on the simulator and device and then disappears out of view). - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller { controller.searchBar.showsCancelButton = NO; } Is there a better way to hide it? I managed to hide the "Cancel" button by subclassing

UISearchDisplayController animate reloadData

走远了吗. 提交于 2019-11-29 16:11:25
I've been reading all the documentation about UISearchDisplayController and its delegate but I can't find any way to animate the table view when the search criteria change. I'm using these two methods : They both return YES but still can't find any way to do something similar to : I don't know if it's important but I'm using an NSfetchedResultsController to populate the UITableView in the UISearchDisplayController That's it thanks ! When the search string or scope has changed, you assign a new fetch request for the fetched results controller and therefore have to call performFetch to get a new

How to Show and Hide UISearchDisplayController's UISearchBar

浪子不回头ぞ 提交于 2019-11-29 15:49:53
问题 I have a button search that located in the right side of the navigation. This is my code: UIButton *btnSearch = [UIButton buttonWithType:UIButtonTypeCustom]; btnSearch.frame = CGRectMake(0, 0, 22, 22); [btnSearch setImage:[UIImage imageNamed:@"search_btn.png"] forState:UIControlStateNormal]; [btnSearch addTarget:self action:@selector(showSearch:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *searchItem = [[UIBarButtonItem alloc] initWithCustomView:_btnSearch]; self

UISearchDisplayController and UITableView prototype cell crash

笑着哭i 提交于 2019-11-29 11:10:11
问题 I have a UIViewController setup in a storyboard with a tableview and UISearchDisplayController . I am trying to use a custom prototype cell from self.tableview (which is connected to main tableview in the storyboard). It works fine if self.tableview had returned at least 1 cell when I load my view, but if self.tableview doesn't load a cell (as there is no data), and I load up the UISearchBar and search, the cellForRowAtIndexPath: method crashes: - (UITableViewCell *)tableView:(UITableView *

UISearchDisplayController not correctly displaying custom cells

人盡茶涼 提交于 2019-11-29 08:38:56
问题 So I have a tableView that has sections and rows, and it uses a custom cell class. The custom cell has an image view and a few labels. The table view works fine, and the search works, except the search does not display any of the labels that are in my custom cell class, only the imageView with the correct image. I am quite confused as to why this is, especially since the image is still displayed, but not the labels. Here is some code. - (UITableViewCell *)tableView:(UITableView *)tableView

How do I cover the “no results” text in UISearchDisplayController's searchResultTableView?

﹥>﹥吖頭↗ 提交于 2019-11-29 03:54:32
问题 I don't want to show the "no results" text while my server is processing a search query. I figured out the exact coordinates of the table cell that contains the label and attempted to cover it. self.noResultsCoverView = [[[UIView alloc] initWithFrame:CGRectMake( 0.0, 44.0, 320.0, 43.0 )] autorelease]; self.noResultsCoverView.backgroundColor = [UIColor whiteColor]; [self.searchDisplayController.searchResultsTableView addSubview:self.noResultsCoverView]; To my chagrin, my cover was above the

Creating a UISearchDisplayController programmatically

五迷三道 提交于 2019-11-29 01:52:48
I'm trying to create a UISearchDisplayController programmatically. I have a method which should set up my search controller, but when I call it, nothing happens. This my -setupSearch method: - (void)setupSearch { UISearchBar *myBar; UISearchDisplayController *myCon; myBar = [[UISearchBar alloc] initWithFrame:CGRectZero]; [myBar sizeToFit]; myCon = [[UISearchDisplayController alloc] initWithSearchBar:myBar contentsController:self]; [myBar release]; myCon.delegate = self; myCon.searchResultsDataSource = self; myCon.searchResultsDelegate = self; /* Setup scopes */ { NSMutableArray *scopes;