uisearchbar

Double tap UISearchBar with search delegate on iOS 7 causes UISearchBar to disappear

人盡茶涼 提交于 2019-12-03 14:35:06
We have a search bar in the table header. When the user taps on it twice quickly on iOS 7, it disappears. Does anyone have any suggestions what we are doing wrong? After lots of trial and errors, I found that when searchDisplayController ends search, searchbar gets disappear, so I have reinserted the searchbar to table header and it worked for me. - (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller { self.searchingFetchedResultsController = nil; if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) { [self.tableView insertSubview:self

UISearchbar keyboard search button Action

空扰寡人 提交于 2019-12-03 14:28:02
问题 I'm using UISearchBar when I input text on UISearchBar the keyboard shows. At that time, keyboard return key is "Search". I want to implement event when I press the keyboard search button. How can I implement the action? On UITextField it has -(BOOL)textFieldShouldReturn:(UITextField *)textField; But on UISearchBar it doesn't have return action. Thank you for your helping. 回答1: Add UISearchBarDelegate in .h Also set SearchBar's object delegate to self. Add this to the UISearchBarDelegate's

UISearchBar Not shifting up

一笑奈何 提交于 2019-12-03 14:27:57
Somehow i dun know why does the default animation fails. my Search bar did not shift up as it supposed to be. the view is in UIView, i'm wondering if this is the problem. Included the IB layout The searchbar doesn't actually move in the 'push-up' animation. Rather it stays in place while the navbar goes up, thus pulling the rest of the view with it. You should be able to move the search bar manually in code by registering as its delegate (UISearchBarDelegate) and responding to these calls. #pragma mark - UISearchBarDelegate Methods - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {

UISearchBar stretches text when it begins editing

我只是一个虾纸丫 提交于 2019-12-03 14:05:19
I have an instance of a UISearchBar added to the title view of a UINavigationBar. When there is text already set and the search bar starts editing it resizes its contents to allow space for the Cancel button, although, the resulting animation stretches the text, as showed in the gif below Is there anything that can be done to avoid this defect effect? I have tried to remove the text and then to add it back a few moments later, although it works, it is not an elegant solution. Update Based on @Paruru's answer I tried to anticipate the animation of the Cancel button and it doesn't look bad. What

Customizing search bar in iPhone application Development

一世执手 提交于 2019-12-03 13:59:05
问题 In my application I have to add a search bar at the head of the tableview. I am able to add the searchbar but problem is without adding default search bar of ios can i add my customize search bar?? I am giving an image to see what types of search bar will be there... 回答1: you can subclass the UISearchBar and override the layoutSubviews method : - (void)layoutSubviews { UITextField *searchField; NSUInteger numViews = [self.subviews count]; for(int i = 0; i < numViews; i++) { if([[self.subviews

iOS autocomplete feature

女生的网名这么多〃 提交于 2019-12-03 13:10:03
问题 What most people mean by autocomplete is that the app has a textview/searchbar/whatever which accepts user input. Attached to this component is a tableview which keeps updating based on the user input. This is a well researched topic and is now relatively easy to implement thanks to the UISearchDisplay controller. Now here is what I want. When the user is typing in some text in the UISearchBar, there will be no searchdisplaycontroller. Instead, I want the app to do something like Google

Add filter button to UISearchController

流过昼夜 提交于 2019-12-03 12:29:45
问题 I want to add a "filter" or "sort" button next to the searchBar inside a UISearchController . I have already tried to add the UIButton and the searchbar into a UIView and set this as my UITableView tableView.tableHeaderView This does not work because the tableView.tableHeaderView get's set back to the UISearchBar only when dismissing the controller. Here is an example of how I want it to look: 回答1: I could create a search filter with a few lines of code. I hope it helps. *I chose the bookmark

Focus on the UISearchBar but the keyboard not appear

家住魔仙堡 提交于 2019-12-03 11:36:01
I've read so many solution on how can i focus a searchbar to make keyboard appear when i open my search view, and all of that are like this [searchBar becomeFirstResponder]; mine is [self.searchDisplayController.searchBar becomeFirstResponder]; but I tried both. Now, I tried this, and I also added a [self.searchDisplayController setActive:YES]; because I'm using a SearchDisplayController, but so far the best result i can have is to have the cursor on the searchbar, the uitableview with an overlay on it, but still no keyboard. If I run the simulator I can type on the searchbar with my computer

Search bar overlaps with status bar on iOS 11

℡╲_俬逩灬. 提交于 2019-12-03 11:15:49
I am using a UISearchController and a UISearchResultsController to implement search functionality. MySearchResultsController implements UISearchResultsUpdating and UISearchBarDelegate: override open func viewDidLoad() { super.viewDidLoad() self.edgesForExtendedLayout = []; self.automaticallyAdjustsScrollViewInsets = false; } I display the searchbar in the tableHeader like this in MyTableViewController: - (void)viewDidLoad { [super viewDidLoad]; self.searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultsController]; self.searchController

UISearchController doesn't hide view when pushed

让人想犯罪 __ 提交于 2019-12-03 10:50:53
I am using UISearchController to display a search bar and results within a UITableView. I managed to set it up correctly, but when I search the results and then select one of the rows in the tableview, and push a new view controller to the navigation stack, I would expect the search bar to not be visible anymore. However, when I try this, the search bar from the first view controller is visible in the 2nd view controller: if (self.searchController == nil) { self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchController.searchResultsUpdater =