uisearchdisplaycontroller

UISearchBar animation issue

瘦欲@ 提交于 2019-11-28 05:56:35
I have a UIViewController in wich I want to show a tableview with the serchBar. As Simple as That: //viewDidLoad _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH(), SCREEN_HEIGHT()) style:UITableViewStylePlain]; _tableView.delegate = self; _tableView.dataSource = self; [self.view addSubview:_tableView]; // adding uisearch bar searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; _tableView.tableHeaderView = searchBar; // searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];

UISearchDisplayController - how to preload searchResultTableView

喜欢而已 提交于 2019-11-28 05:50:00
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 whole UISearch functionality yourself in a custom controller? For a demo of the desired effect, look at

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

吃可爱长大的小学妹 提交于 2019-11-28 03:35:26
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 the keyboard. When I enter the search bar, and show the keyboard and hit 'Search' again (just to hide

Assertion failure when using UISearchDisplayController in UITableViewController

妖精的绣舞 提交于 2019-11-28 03:18:00
I've been trying to add simple Search functionality to a TableViewController in my app. I followed Ray Wenderlich's tutorial. I have a tableView with some data, I added the search bar + display controller in storyboard, and then I have this code: #pragma mark - Table View - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BreedCell" forIndexPath:indexPath]; //Create PetBreed Object and return corresponding breed from corresponding array PetBreed *petBreed = nil; if

Strange UISearchDisplayController view offset behavior in iOS 7 when embedded in navigation bar

旧时模样 提交于 2019-11-27 20:33:48
问题 I am building an iOS 7-only app. I am trying to set a UISearchDisplayController into the navigation bar. I have it set up like this: In the storyboard, I added a "Search Bar and Search Display Controller" to my view controller's view, and set it at (0,0) relative to the top layout guide. I set constraints to pin to left, top and right. (I played with the constraints, i removed them completely, it doesn't matter) On top of that I have my Table view. When I added the search bar to the view in

How to change background color of UISearchBar in iOS7

寵の児 提交于 2019-11-27 19:53:40
问题 How to change background color of UISearchBar in iOS7? not gray, I want to change color like my uinavigationbar if I Use this code, that's what comes out searchBar.backgroundColor = [UIColor redColor]; That is not red color!!! This exact same situation as in background color of navigation bar. 回答1: Need to use: searchBar.barTintColor = [UIColor redColor]; All thanks! 回答2: Set the background image to a clear image and you're good to go. This is also pre-ios 7 compatible. searchBar

Creating a UISearchDisplayController programmatically

夙愿已清 提交于 2019-11-27 16:19:00
问题 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

Search Bar and Search Display Controller in table view

隐身守侯 提交于 2019-11-27 14:15:21
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 the whole elements and the second one for the filtered ones: NSArray* OldList; NSArray* filteredList;

UISearchDisplayController causes crash after viewDidUnload

拈花ヽ惹草 提交于 2019-11-27 13:02:45
问题 I have a project using StoryBoards and UISearchDisplayController used in the context of a UINavigationController , that appears in the root viewcontroller. When I push a new view controller onto the stack and I cause a simulated memory warning (or actually get a low memory warning). The previous view controller successfully unloads its view. However, when I pop the second view controller off of the stack I get an EXC_BAD_ACCESS . I turned on NSZombies and discovered this:

How can I change strings of “Cancel” button, “No Results” label in UISearchBar of UISearchDisplayController?

余生颓废 提交于 2019-11-27 11:51:22
How can I change strings of "Cancel" button, "No Results" label in UISearchBar of UISearchDisplayController? I solved it myself. Cancel Button> (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { [controller.searchBar setShowsCancelButton:YES animated:NO]; for (UIView *subview in [controller.searchBar subviews]) { if ([subview isKindOfClass:[UIButton class]]) { [(UIButton *)subview setTitle:@"_____" forState:UIControlStateNormal]; } } } No Results Text> - (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView: