uisearchbar

Having Problems With UISearchBar in UITableViewController

╄→尐↘猪︶ㄣ 提交于 2019-12-03 23:07:04
问题 I am trying to add a UISearchBar to my UITableView. This is the method they use to search: - (void) searchTableView { NSString *searchText = searchBar.text; NSMutableArray *searchArray = [[NSMutableArray alloc] init]; for (NSDictionary *dictionary in listOfItems) { NSArray *array = [dictionary objectForKey:@"Countries"]; [searchArray addObjectsFromArray:array]; } for (NSString *sTemp in searchArray) { NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch]

How to change SearchBar border color

时光总嘲笑我的痴心妄想 提交于 2019-12-03 22:12:50
I would like to change grey border color in my Search Bar to white color. Now it looks like that: I achieved this effect after using this lines of code, but "inside border" is still grey: var searchBar: UISearchController! self.searchBar.searchBar.backgroundColor = UIColor.whiteColor() self.searchBar.searchBar.layer.borderWidth = 3 self.searchBar.searchBar.layer.borderColor = UIColor.whiteColor().CGColor self.searchBar.searchBar.layer.backgroundColor = UIColor.whiteColor().CGColor self.searchBar.searchBar.tintColor = UIColor(red: 0.3, green: 0.63, blue: 0.22, alpha: 1) Can somebody help me in

UISearchBar with UISearchDisplayController animates outside screen

不羁的心 提交于 2019-12-03 20:47:31
I have standard iPad view controller which has a custom navigation bar at the top. In the xib-file I've added a UISearchBar aligned to the right edge of the view. The search bar is 320px in width. I init a searchdisplaycontroller like this: // Search display controller self.mySearchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:_searchBar contentsController:self]; _mySearchDisplayController.delegate = self; _mySearchDisplayController.searchResultsDataSource = self; _mySearchDisplayController.searchResultsDelegate = self; The problem is that when I press the search bar

How to change border and icons in Search bar (Swift)

痞子三分冷 提交于 2019-12-03 20:45:38
I have this: http://postimg.org/image/ag29m3e7d/ and I need this http://postimg.org/image/4bacislw5/ I have to create border or set it by image? How to change search icons(magnifier and X icon) or could I change just colors? Sorry for links but I cannot insert images here. To add borders use the views layer property. self.searchBar.layer.borderColor = UIColor.blueColor().CGColor self.searchBar.layer.borderWidth = 1 If you want to add the corner radius to the searchBar: self.searchBar.layer.cornerRadius = 3.0 self.searchBar.clipsToBounds = true To change the searchIcon call the following method

How do I change the UISearchbar cancel button's text color

给你一囗甜甜゛ 提交于 2019-12-03 19:32:49
问题 I have a UISearchBar as seen below. How can I change the text color for the cancel button? 回答1: This question was asked a while ago, therefore I assume that the person who asked has already found a solution. But just in case some others happen to bump into the same problem. Here is my solution. I have a UISearchBar with a cancel button that appears only when the textfield of the UISearchBar is tapped. The solution of overriding -(void)layoutSubviews in a subclass of UISearchBar was therefore

UISearchController searchBar in tableHeaderView animating out of the screen

时光毁灭记忆、已成空白 提交于 2019-12-03 18:57:27
问题 I have a UISearchController with a UITableViewController as a searchResultsController , the UISearchBar of this searchController is set to be in the tableHeaderView of my current tableView displayed in my root ViewController. Almost everything is working well, as expected. But in the animation of the UISearchBar (When i click on the searchBar and the UINavigationBar hides and the searchBar goes to the top, as in the UISearchDisplayController ) i have a strange behavior. Instead of moving to

Remove Border of UISearchBar in iOS7

扶醉桌前 提交于 2019-12-03 18:38:06
问题 I'm trying to remove border of UISearchBar in iOS 7. In iOS 6 it's working fine. I created the UISearchBar programatically. I tried almost every thing from Stack Overflow and Google. SearchBar looking right now What i want to achieve I tried all these stuffs mentioned below searchBar.layer.borderWidth = 1; searchBar.layer.borderColor = [[UIColor whiteColor] CGColor]; and for (id img in searchBar.subviews) { if ([img isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) { [img

How to change the alignment of a UISearchBar according to the input language

两盒软妹~` 提交于 2019-12-03 17:31:11
I would like to be able to input text in either Left-to-Right and Right-to-Left languages into a UISearchBar. This means that once a user has started inputing text in right to left languages, I would like the text alignment to be to the right and vice versa. The question is - Is there any way to catch these events of language switching? Thanks for your help. Yes there is. You want to subscribe to UITextInputCurrentInputModeDidChangeNotification . See the UITextInputMode Class Reference . Use this code in ViewDidLoad searchbar.semanticContentAttribute = .forceRightToLeft 来源: https:/

Hide UISearchBar clear text button

无人久伴 提交于 2019-12-03 16:18:15
问题 I would like to know how to hide or not display the UISearchBar cross that appears in the textField fo the UISearchBar I have tried using this filterSearchBar.showsCancelButton = NO; However this is an actual cancel button not the small grey cross, so I would like to know if there is an equivalent for the small grey button that shows in the UISearchBar . 回答1: You need to get the textField of the Search Bar: UITextField *textField = [searchBar valueForKey:@"_searchField"]; textField

UISearchDisplayController automatically creates a UIPopovercontroller to display content search result ?! How to dismiss it?

ぃ、小莉子 提交于 2019-12-03 14:37:51
问题 I'm using a UISearchDisplayController with a UISearchBar. I put this UISearchBar in my app using IB and I get : alt text http://img6.imageshack.us/img6/1985/screenshot20100701at156.png Fine : when you start taping, the result popovercontroller appears magically (I didn't write anything on my own to make it appear !) Then, when a row is clicked among the result, I want to dismiss the PopoverController BUT at this stage, I never instantiated the UIPopoverController on my side : it looks like if