uisearchbar

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

萝らか妹 提交于 2020-01-05 07:29:05
问题 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];

Search Bar showing wrong/mixed cell results

给你一囗甜甜゛ 提交于 2020-01-05 06:17:22
问题 I have a problem in my iOS project. I'm using a search bar to filter my array in my custom tableview to show the matching keywords of the search. It shows no code errors but obviously there's a problem. Normally there's over 20+ items in my tableview but when I search, it only shows the first cell that my tableview normally has without searching, the same image for that cell to be exact, but it is not the same cell because each cell has a button showing specific information through a label in

SearchBar in NavigationBar IOS 11

☆樱花仙子☆ 提交于 2020-01-05 04:40:50
问题 I tried using Navigation Bar Large Title and adding Search Bar to Navigation Controller. The Search Bar is displayed under the Navigation title. It should be hidden until I swipe down. I understand that the default behavior is hidden unless I set "navigationItem.hidesSearchBarWhenScrolling = false". Even I add "navigationItem.hidesSearchBarWhenScrolling = true", it doesn't work. I created a new app to test this function. It has ViewController and Navigation Controller embedded. Below is my

IPhone Keyboard hides UISeachBar

左心房为你撑大大i 提交于 2020-01-05 04:08:15
问题 I have a search bar at the bottom of a view. The issue is whenever I type something in the keyboard, the search bar still remains at the bottom and I cannot view what I am typing. I would like to dynamically move it up whenever the keyboards pops up and then take back its original position after the keyboard disappears. And unfortunately the search bar has to be in the bottom for my app and kind of stuck in this. Is there any way around to move the search bar up only when the keyboard appears

Change UISearchBar magnify icon color and position

♀尐吖头ヾ 提交于 2020-01-04 06:15:21
问题 I have a UISearchBar and I would like to change the position of the initial magnify icon (the one that appears in the middle of the UISearchBar) as well as the color or icon. So far I changed the tint and the icon image. However, the new icon shows up only if I test the app on a simulator but on an actual device(both run iOS 9.3) it still shows the default icon. UISearchBar.appearance().setImage(UIImage(named: "SearchbarIcon"), forSearchBarIcon: UISearchBarIcon.Search, state: UIControlState

change search magnifying glass to UIActivityIndicatorView

╄→гoц情女王★ 提交于 2020-01-04 05:30:12
问题 I have an app that searches through 13,000 cells for text. I know it is a lot of cells. On older iphones the search takes multiple seconds so I wanted to provide an indicator view that showed the user that the app was still working. I came up with the idea of changing the UISearchBar magnifying glass to a UIActivityIndicatorView. The code works in the simulator but the spinner doesn't show up when I test on an old ipod touch. It actually does show up but only after the search is complete. Any

How to make searchbar corner round

让人想犯罪 __ 提交于 2020-01-04 04:36:51
问题 I am trying to make searchBar corner rounded. I have tried many ways of using layer.cornerRadius , maskToBound = true . I am loading the searchBar in the navigationBar programmatically. I have tried many solution given on stack-overflow but nothing worked. func setupsearchbar() { // Setup the Search Controller searchcontroller.searchResultsUpdater = self as? UISearchResultsUpdating searchcontroller.hidesNavigationBarDuringPresentation = false searchcontroller.searchBar.placeholder = "Search"

SearchBar problem while trying to search Firestore and reload the tableview

喜夏-厌秋 提交于 2020-01-03 06:00:41
问题 I have a tableView and I use infinite scroll to populate firestore data with batches. Also I have a searched bar and I am trying to query firestore with the text from the text bar and then populate it in the tableview. I have 3 main problems. When I click search thee first time I get an empty array and an empty tableview, but when I click search the second time everything seems fine. When I finally populate the searched content I want to stop fetching new content while I am scrolling. If I

UISearchBar displaysSearchBarInNavigationBar

自闭症网瘾萝莉.ら 提交于 2020-01-03 05:07:13
问题 I want to replicate the functionality of the Twitter app where the search bar slides in to the navigation bar. However i have run into a problem. If i don't add [self.searchDisplayController setDisplaysSearchBarInNavigationBar:YES]; into viewDidLoad the bar will not appear. I have a search button in the righthand navigation item when i click it i call the above method. Is there anything i can do to ensure the search bar gets drawn Thanks Jonathan 回答1: You can add search bar on navigation bar.

UISearchBar in UINavigationBar can't add UIBarButtonItem

青春壹個敷衍的年華 提交于 2020-01-02 16:53:39
问题 I'm trying to add a UISearchBar to a UINavigationbar using self.searchDisplayController.displaysSearchBarInNavigationBar = YES; The UISearchBar gets added quite well into the UINavigationBar, but the left/right UIBarButtons are gone. I just can't figure out how to add them. Andy ideas or examples on this? 回答1: Dumb error from mine. When using self.searchDisplayController.displaysSearchBarInNavigationBar = YES; You need to use self.searchDisplayController.navigationItem to add the UIBarButtons