uisearchbar

Adding button to left of UISearchBar

匆匆过客 提交于 2019-12-17 17:36:28
问题 I am tearing my hair out on this one. My client wants to add a button to the left of a search bar like the example below: (source: erik.co.uk) But I just can't figure out how to do it. Apple don't seem to provide any documented method for adding custom buttons to a UISearchBar, let alone to the left of the search bar. I've tried hacking around in Interface Builder adding a UIToolbar with a button in it to the left but I cannot find any combination of styles where the two line up properly to

UISearchView not displaying search values

情到浓时终转凉″ 提交于 2019-12-17 16:54:34
问题 In my TableView which Expands on the clicking on the sections.now I am using Uisearchbar to search the sections in the table...It gives me the UIsearchbar but Search cannot be taken... I think problem is in the numberOfRowsInSection .please check where I am getting wrong.. why searchbar is not working - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [self.mySections count]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

iOS 11 UISearchBar in UINavigationBar

和自甴很熟 提交于 2019-12-17 15:27:54
问题 I want to place a search bar in the new navigation bar with the new iOS 11 large titles. However, the color of the search bar is automatically applied by iOS and I can't change it. if #available(iOS 11.0, *) { let sc = UISearchController(searchResultsController: nil) navigationItem.searchController = sc navigationItem.hidesSearchBarWhenScrolling = false } The search bar get's a deep blue background, but I just want to change it to white. Setting the background color results in this:

Change UISearchBar/Keyboard Search Button Title

柔情痞子 提交于 2019-12-17 15:22:12
问题 In the UISearchBar control, is the a way to change the Search key title for the keyboard to Done? 回答1: For a searchbar named tablesearchbar: // Set the return key and keyboard appearance of the search bar for (UIView *searchBarSubview in [tableSearchBar subviews]) { if ([searchBarSubview conformsToProtocol:@protocol(UITextInputTraits)]) { @try { [(UITextField *)searchBarSubview setReturnKeyType:UIReturnKeyDone]; [(UITextField *)searchBarSubview setKeyboardAppearance:UIKeyboardAppearanceAlert]

iOS7 when UIsearchbar added in UINavigationBar not showing cancel button

我只是一个虾纸丫 提交于 2019-12-17 10:44:52
问题 I add UISearchBar above UINavigationBar and set UIsearchbar showsCancelButton YES, work fine in iOS6 but in iOS7 not showing cancel button. I used below code snippet UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 600, 44)]; searchBar.showsCancelButton = YES; searchBar.translucent = NO; [searchBar setTintColor:[UIColor redColor]]; searchBar.backgroundColor = [UIColor yellowColor]; [self.navigationController.navigationBar addSubview:searchBar]; 回答1: For some reason

How to implement UISearchController in UITableView - Swift

北城余情 提交于 2019-12-17 10:19:46
问题 I am a newbie to Swift and I am trying to add search functionality to my UITableView which is in a UIViewController class. I googled a lot and found that UISearchDisplayController has been deprecated and replaced by UISearchController. When I tried to search for tutorials I did not find any specifically for UITableView . Some of them were for implementing in UITableViewController . So here are my questions: Can we implement UISearchController in a UITableView that is in a UIViewController

Styling the cancel button in a UISearchBar

大城市里の小女人 提交于 2019-12-17 10:19:08
问题 I have a UISearchBar that has a cancel button (it's displayed using -(void)setShowsCancelButton:animated ). I've changed the tintColor of the search bar like this in an attempt to get a grayish searchbar: UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 40)]; searchBar.tintColor = [UIColor colorWithWhite:0.8 alpha:1.0]; This is what it looks like now - notice how the cancel button is also gray: http://twitpic.com/c0hte Is there a way to set the color of the

Cannot set searchBar as firstResponder

无人久伴 提交于 2019-12-17 09:09:04
问题 I have a searchBar I'm setting in a tableviewcontroller. i've referenced this similar question UISearchBar cannot become first responder after UITableView did re-appear but am still unable to set it as first responder. In .h file: @property (strong, nonatomic) UISearchController *searchController; @property (strong, nonatomic) IBOutlet UISearchBar *searchBar; In view didload: self.searchController = [[UISearchController alloc]initWithSearchResultsController:nil]; self.searchController

How to change the default text of Cancel Button which appears in the UISearchBar +iPhone

血红的双手。 提交于 2019-12-17 08:48:57
问题 I am developing an Application where I wanted to change the text of Search String in the SearchBar. I wanted to change the text of Cancel Button Also which appears next to the SearchBar. Before entering any string in the search bar we wil get the Search String as the default string. I wanted to change the text of that string and when we click on that searchbar we get a cancel button next to searchbar and I wanted to change the text of that cancel button. 回答1: You also need to have the

Displaying search bar in navigation bar in iOS 8

╄→гoц情女王★ 提交于 2019-12-17 07:12:47
问题 UISearchDisplayController had a boolean property called displaysSearchBarInNavigationBar . What's the equivalent in iOS 8 to have my search bar move up there? Any guidance is greatly appreciated. Here's my code, I'm not entirely sure why this isn't working. When I click the search bar, it just disappears instead of moving itself and the navigation bar up. import UIKit class ViewController: UIViewController, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate,