uisearchbar

NSCompoundPredicate

时光总嘲笑我的痴心妄想 提交于 2019-12-23 09:43:12
问题 I'm trying to filter a UITableView's data using a UISearchDisplayController and NSCompoundPredicate . I have a custom cell with 3 UILabels that I want to all be filtered within the search, hence the NSCompoundPredicate . // Filter the array using NSPredicate(s) NSPredicate *predicateName = [NSPredicate predicateWithFormat:@"SELF.productName contains[c] %@", searchText]; NSPredicate *predicateManufacturer = [NSPredicate predicateWithFormat:@"SELF.productManufacturer contains[c] %@", searchText

How to remove the extra black line beneath UISearchBar?

女生的网名这么多〃 提交于 2019-12-23 07:20:36
问题 After setting the tint of a UISearchBar to White: There is an extra black line between the search box and the table: How can I remove the black line? 回答1: Just a tweak... searchBar.layer.borderWidth = 1; searchBar.layer.borderColor = [[UIColor whiteColor] CGColor]; 回答2: I realize Legolas answer is old - but I stumbled upon the same problem, and now it seems there instead of a borderColor is a special view acting as a shadow which creates this effect. The only way of fixing this is to search

UISearchBar and resignFirstResponder

落花浮王杯 提交于 2019-12-23 07:00:07
问题 I have a very basic UITableView with an attached UISearchBar, and here's the flow of what happens UITableView is empty, user taps UISearchBar, and brings up keyboard. Once the user taps the Search button - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { [searchBar resignFirstResponder]; //move the keyboard out of the way //Code.... } Works just fine, and moves the keyboard out of the way, and populates the UITableView. The problem is any subsequent search attempts. The same

UIsearch bar not returning data to table

与世无争的帅哥 提交于 2019-12-23 05:31:14
问题 Edited code - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell==nil) cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; if (isFiltered) { int rowCount=indexPath.row; Aves *filtrada=[filteredTableData objectAtIndex:rowCount]; cell.textLabel.text

iOS: Call function after a few seconds the user did finish typing

笑着哭i 提交于 2019-12-23 05:20:02
问题 I'd like to create an UISearchBar function, which gets called like the search in the App Store: Execute the function (NSURLConnection) after a few seconds (NSTimer) the user did finish typing and just one time for this period. Does anyone have an idea? EDIT self.currentTaskID = self.currentTaskID + 1; NSInteger taskID = self.currentTaskID; dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC),

Getting “Assertion failure” in UISearchResultsTableView

假装没事ソ 提交于 2019-12-23 04:37:06
问题 I'm getting the following error when i start type the search text in SearchBar Assertion failure in -[UISearchResultsTableView _configureCellForDisplay:forIndexPath:] My cellForRowAtIndexPath code for Search Display Controller is as follows : if(tableView == self.searchDisplayController.searchResultsTableView) { static NSString *CellIdentifier = @"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil) { cell = [tableView

How to Search Struct (Swift)

你离开我真会死。 提交于 2019-12-23 04:35:57
问题 I am changing my 2 arrays... var title = ["Title 1", "Title 2", "Title 3"] var artist = ["Artist 1", "Artist 2", "Artist 3"] ...to a struct struct Song { var title: String var artist: String } var songs: [Song] = [ Song(title: "Title 1", artist "Artist 1"), Song(title: "Title 2", artist "Artist 2"), Song(title: "Title 3", artist "Artist 3"), ] I set up my UITableView so that the title of the cell equals songs[indexPath.row].title , and the subtitle of the cell equals songs[indexPath.row]

Issue with UISearchBar and UITableView in iOS7

只谈情不闲聊 提交于 2019-12-23 02:50:20
问题 I have an app that works fine in iOS6. It has a table view with a search bar. When I run it in iOS7 I got the following issue: As you can see in the image above, the search results are displayed in a wrong position, they are overlapping the search control, any idea how to fix this? The first image is showing the search control, and the search results should be shown in the position I marked in red in that first image. Thanks. -Fernando Well, I made some changes but it is still not so good: -

How to expand a UISearchBar when it becomes active

谁说胖子不能爱 提交于 2019-12-23 02:46:19
问题 I have a UISearchBar that needs to be compressed (see screenshot) and then expand to a larger size when it is touched or isActive. How would I go about doing this? Currently my search bar is placed in the view via IB. thanks 回答1: I would suggest adding a NSNotifcation listener for the keyboard showing/hiding notifications and based on this adjust the UISearchBar frame: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; NSNotificationCenter *nc = [NSNotificationCenter

Custom class for UISearchDisplayController's table view

a 夏天 提交于 2019-12-23 02:45:46
问题 I need to make the table view inside the UISearchDisplayController class to be a custom class which extends from UITableView . I'm using this pod: https://github.com/OliverLetterer/SLExpandableTableView, but I can't seem to make it work when using a UISearchBar and search results. The class I want use for the table view it's called SLExpandableTableView and it has several methods and properties which makes subrows work. Thanks in advance. 回答1: Not sure that's possible. I believe the problem