uisearchbar

Change UISearchBar cancel button text in iOS 8

末鹿安然 提交于 2020-01-10 06:59:05
问题 I'd like to change the text from ¨Cancel¨to ¨Done¨ of the Cancel button inside the UISearchBar in iOS 8. I am using UISearchController. I've tried different approaches for iOS 6 and iOS 7 and they do not work. Has anybody done this? 回答1: Objective-C: [searchBar setValue:@"customString" forKey:@"_cancelButtonText"]; Swift: searchBar.setValue("customString", forKey:"_cancelButtonText") 回答2: This worked for me in ios8, did not try in ios7, but should do the trick, beware of placing this line in

Custom scope buttons

£可爱£侵袭症+ 提交于 2020-01-07 05:25:27
问题 I'm trying to create custom scope buttons, but i'm having trouble actually linking them to my buttons. This is what I have extension HomeViewController: UISearchResultsUpdating { func updateSearchResults(for searchController: UISearchController) { let searchBar = searchController.searchBar let scope = titles[searchBar.selectedScopeButtonIndex] filterContentForSearchText(searchText: searchController.searchBar.text!, scope: scope) } } extension HomeViewController: UISearchBarDelegate { func

UISearchBar of an string within an array

冷暖自知 提交于 2020-01-07 05:10:09
问题 I am trying to create a dictionary type app with section header, title text, and subtitle text. I managed to get everything to work using the following code. The only thing I can't figure out is how to filter the UISearchBar to show the results of the String [Coptic] within the array. Is this even possible the way I organized everything or do I need to restructure? Does anyone have any suggestions? I left the code for the updateSearchResults blank on the bottom because I don't know what to

Search bar does not appear in ios

旧时模样 提交于 2020-01-07 03:54:10
问题 I have page controller in which I added two tableviews. In each header of tableview search controller added, also viewForHeader method return "Recent" and "Other" view's. My problem is the search bar does not appear when the search bar clicked. It appear to move up, I cant see what I am typing there. There may be the possibility that the search bar is hidden behind "Connection","Message" tab. How to keep search bar at same position when keyboard become first responder? any help will

SearchBar in Navigation Bar not working

蹲街弑〆低调 提交于 2020-01-06 15:18:43
问题 For reference, I'm running the below on an iPad with iOS 7.0.4. The vc is a presented modally as a form page. The search vc is the second vc on the navigation stack. My table is setup with a search bar and search display controller and is working fine with the search bar located in the header of the table. It returns search results just fine...see image: !http://www.mcartherstkd.com/images/search.png I make a one line code change in the vc's viewdidload method to move the search bar to the

UINavigationBar turns white and won't close when using navigationItem.searchController in iOS 13

北城以北 提交于 2020-01-06 08:13:01
问题 I am having trouble using navigationItem.searchController in iOS 13. The search bar of the search controller is initially closed, but it won't collapse back after I scroll the table view. It 'bounces' back when I try to hide the bar. Also, the navigation bar turns white after the search bar appears. (The navigation bar has a custom tint color; see the attached screenshots.) Note that this wasn't the case in iOS < 13. Is this a bug in iOS 13? If it is, is there a work around to keep the tint

UINavigationBar turns white and won't close when using navigationItem.searchController in iOS 13

自闭症网瘾萝莉.ら 提交于 2020-01-06 08:12:35
问题 I am having trouble using navigationItem.searchController in iOS 13. The search bar of the search controller is initially closed, but it won't collapse back after I scroll the table view. It 'bounces' back when I try to hide the bar. Also, the navigation bar turns white after the search bar appears. (The navigation bar has a custom tint color; see the attached screenshots.) Note that this wasn't the case in iOS < 13. Is this a bug in iOS 13? If it is, is there a work around to keep the tint

SwiftUI BIG list search

吃可爱长大的小学妹 提交于 2020-01-06 08:05:48
问题 Hello i'm try to search an airport in a big list of item create from an Array called airportVector of type AirportModel, but when I try to lunch the search as soon I type the first letter everything block! looks like the list is too big . if I leave only few item the list work. I tried to make my model conform to Equatable and Hashable but i'm not to expert how to use it.. look for some help or suggestion how to avoid the block. here my model import Foundation class AirportModel :

iOS: Setting text in nib subview from view in UITabBar/UINavigationController application

纵然是瞬间 提交于 2020-01-06 04:52:27
问题 I'm having a problem getting a UISearchDisplay's text value to be set programatically on load of the view by another view and my question is have I overcomplicated my problem and missed something or am I on the right track of thinking. Here's the situation: I have a UITabBarController as my root view, there are 2 tabs, both have a UINavigationController setup so I can push views as needed. Tab 1 has a UITableViewController which is populated with a list of categories. Tab 2 has a MapView in

How can I determine the index of an object in an NSMutableArray when I search for a NSString within it?

二次信任 提交于 2020-01-05 07:30:15
问题 Currently I am coding the search capability of a UISearchBar using data from a DB that's displayed in a table. I figure out the search results and save them to NSMutableArray *searchResults . Here's how that looks: - (void) searchGrapesTableView { [searchResult removeAllObjects]; numSearchWines=0; for (NSString *str in listOfWines) { NSRange titleResultsRange = [str rangeOfString:searchBar.text options:NSCaseInsensitiveSearch]; if (titleResultsRange.length > 0) { [searchResult addObject:str];