uisearchbar

How can I programmatically force a search in the UISearchBar?

左心房为你撑大大i 提交于 2019-12-20 11:29:53
问题 How can I force the UISearchBar to automatically start a new search (like pressing the Search button)? Is there an easy way to achieve this? 回答1: I found that I needed to set the UISearchViewController to active before changing the value of the search field programatically to make UISearchViewController automatically perform the search: // Need to set the searchDisplayController to active to // make the changes in search text trigger a search. self.searchDisplayController.active = YES; self

How can I programmatically force a search in the UISearchBar?

对着背影说爱祢 提交于 2019-12-20 11:29:08
问题 How can I force the UISearchBar to automatically start a new search (like pressing the Search button)? Is there an easy way to achieve this? 回答1: I found that I needed to set the UISearchViewController to active before changing the value of the search field programatically to make UISearchViewController automatically perform the search: // Need to set the searchDisplayController to active to // make the changes in search text trigger a search. self.searchDisplayController.active = YES; self

filterContentForSearchText and shouldReloadTableForSearchString not called (UITableView & UISearchBar)

陌路散爱 提交于 2019-12-20 03:12:30
问题 I'd like to implement an incremental search of words. I implemented like below, but filterContentForSearchText and shouldReloadTableForSearchString methods are not called. Why? WordsIndexViewController.h #import <UIKit/UIKit.h> @interface WordsIndexViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchDisplayDelegate, UISearchBarDelegate> @end WordsIndexViewController.m #import "WordsIndexViewController.h" #import "WordsShowViewController.h" #import "Word.h"

iOS7: How to add a fixed Search Bar like Contacts on iOS7?

懵懂的女人 提交于 2019-12-19 23:22:39
问题 After I search a lot of questions and answers, no good result. So I have to ask it here: I want to add a Search Bar below the navigation bar. This search bar should be fixed. Just like contacts on iOS7 below. Can any one help me to figure it out? 回答1: You have a view controller. It has a main view. Inside that main view is a search bar (UISearchBar) and, below that, a table view (UITableView). Your view controller is embedded in a navigation controller (UINavigationController).

iOS11 UISearchBar missing in UINavigationBar when embedded in UISplitViewController

喜你入骨 提交于 2019-12-19 10:57:33
问题 Strange things seem to happen when using the new iOS 11 navigationItem.searchController method on a detail view of a UISplitViewController . The searchBar partly appears as a blank space on the first presentation, then appears in the wrong UITableViewController , but corrects itself after a few push and pops of UITableViewController . I used to put the searchBar in the tableHeaderView , but I changed the code according to the WWDC recommendation: if (@available(iOS 11.0, *)) { self

What is the correct usage of the UISearchBarDelegate showsSearchResultsButton attribute?

让人想犯罪 __ 提交于 2019-12-19 10:16:37
问题 I configure my search bar to show the results button, but the button only shows until the user enters a character. At that point, the "X" cancel button replaces it. So without entering characters, the search result set equals the entire data set. I'd like the results button to stay there so when the user has typed enough characters to get a smaller result set (like 5 or 6 rows), they can click the results button, my delegate will get called, and I can show just that result set. UISearchBar *

Displaying suggested locations in UITableView

夙愿已清 提交于 2019-12-19 09:48:09
问题 Basically what I want to do in my app is have a UISearchBar which, when I write in, will feedback location results and populate that into a UITableView that appears. I see one more question on this site: Display Locations on UITableview But that really didn't help me, no answer helped me at all, and they were quite vague. So, my question is. You know how some apps maybe you have to type in a city or country, but the user might not be able to fully spell it, so based on your UISearchBar

Changing the color of the icons in a UItextField inside a UISearchBar

时光总嘲笑我的痴心妄想 提交于 2019-12-19 09:15:33
问题 I'm trying to customise the appearance of the search bar in my search controller. Setting the background and text colors works fine but I just didn't find a way to change the color of the icons in the text field, specifically the magnifying glass and the x button. I've found this Objective-C code which should do what I want but I'm struggling to translate it to Swift: (EDIT: Skip to the first answer for the working Swift 3 solution.) UITextField *searchBarTextField = [self

Called within transaction When UIsearch Bar clicked and keyboard showed

僤鯓⒐⒋嵵緔 提交于 2019-12-19 05:23:50
问题 I did a ViewController where there is a button and UITextfield when I click the button a UITableViewController with a UISearchBar is presented and a list of languages is displayed. My issue is when I run the app the first time I click the button and then click the UISearchBar on my console I have this warning SearchDebugApp[2237:558457] +[CATransaction synchronize] called within transaction SearchDebugApp[2237:558457] +[CATransaction synchronize] called within transaction SearchDebugApp[2237

How to implement search function to UITextView?

拥有回忆 提交于 2019-12-19 04:45:12
问题 I have more than 40 views with their own respective UITexView . I want to implement a search function that allows the user to search across the UITextViews . Actually, I do not even know how to implement search function for 1 UITextView . Therefore I do not know if it is possible at all. I have searched the web and looked for it here but did not find what I looked for. I appreciate your advice. 回答1: This is a pretty easy (may I say obvious?) task. Just think a bit about it. What does