uisearchcontroller

Show UISearchController's SearchResultsController on SearchBar Tap

喜欢而已 提交于 2019-11-28 20:26:52
问题 I am using UISearchController not UISearchDisplayController, and I want to show SearchResultController on SearchBar Tap right away. Right now it's showing like this (when I tap on the search bar): 回答1: When results are empty, UISearchController 's viewController is still hidden. That's why we have to fiddle our way around using UISearchControllerDelegate 's willPresentSearchController: After initializing self.searchController make your ViewController conform to `UISearchControllerDelegate:

When assigning focus via becomeFirstResponder to UISearchController's UISearchBar, the keyboard does not appear

放肆的年华 提交于 2019-11-28 20:13:47
I've spent quite a bit of time searching online and talking to other developers about this issue to no avail. The exact issue is described in this SO post ( Focus on the UISearchBar but the keyboard not appear ), although it's many years old. I recently switched from using the deprecated UISearchDisplayController and UISearchBar in IB, and switched over to UISearchController via the code for iOS8. The problem I'm getting however, is that focus is assigned correctly (you can tell because the cancel button animates to the right of the search bar after the view loads), however the keyboard does

Fixed UISearchBar using UISearchController - Not using header view of UITableView

吃可爱长大的小学妹 提交于 2019-11-28 19:40:53
Is it possible to put UISearchBar of UISearchController somewhere other than header view of UITableView? In the apple's sample code for UISearchController , following is used. [self.searchController.searchBar sizeToFit]; self.tableView.tableHeaderView = self.searchController.searchBar; Is it possible to position searchBar somewhere else? Say we want to implement a fixed UISearchBar like the one used in contacts app. I've tried this but the searchBar doesn't appear at all. You can place the UISearchBar of UISearchController in the navigation bar so that it remains fixed self.searchController

Implement UISearchController with UITableView

丶灬走出姿态 提交于 2019-11-28 14:15:38
Just wondering about the code that was used for the Raywenderlich Tutorial on how to add a UISearchController and how to use it with a UITableViewController I can't seem to get it working and someone told me that it may have got deprecated in iOS 8.0, does anyone know on how to still do this? The UISearchController was Built In The UIViewController NOT StoryBoard! UISearchDisplayController has been deprecated and replaced by UISearchController .And it is available in iOS 8.0 and later. The UISearchController class defines an interface that manages the presentation of a search bar in concert

Cancel button is not shown in UISearchBar

被刻印的时光 ゝ 提交于 2019-11-28 09:45:59
I have UICollectionView . On clicking search button in UINavigationBar , I am adding the UISearchController 's searchbar as titleview for UINavigationItem . For iPhone it is working properly. For iPad the cancel button is not shown. The Searchbar alone takes the entire width. Can anyone help me out on this?. Thanks in advance. iOS7 does not show the cancel button when added to a navigation bar.You can put searchbar in another view like this. UISearchBar *searchBar = [UISearchBar new]; searchBar.showsCancelButton = YES; [searchBar sizeToFit]; UIView *viewForSearchBar = [[UIView alloc

UISearchController doesn't work properly with a non-translucent UINavigationBar

我怕爱的太早我们不能终老 提交于 2019-11-28 09:41:23
Currently I am trying to embed a UISearchController into my application. But the UISearchBar, which is a property of the UISearchController, doesn't get displayed properly, if the UINavigationBar is non-translucent. Usually after tapping the UISearchBar property, the UINavigationBar moves up to make room for the UISearchBar. You can see the result on the following screenshot: https://www.dropbox.com/s/172k63zr2bhj84t/Normal_behaviour.png?dl=0 But if the "translucent" property of the UINavigationBar is set to "NO", the UISearchBar doesn't get displayed properly, because the background of the

UISearchController Not Redisplaying Navigation Bar on Rotate

扶醉桌前 提交于 2019-11-28 07:00:47
I have implemented the UISearchController and it is working great except... When I click on the Search Bar the Navigation Bar disappears nicely as expected. When I rotate the phone to landscape view I get this view which makes sense. However, when I rotate the phone back to portrait view (still selected in search type area) I get this following view. You can see that the Navigation Bar never reappears. I feel I'm implementing a basic search controller. What could possibly be causing this? self.venueSearchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self

iOS 9 searchBar disappears from table header view when UISearchController is active

匆匆过客 提交于 2019-11-28 04:04:30
The structure: View1 (click a button) -> present modally (MyModalView: UITableViewController) MyModalView has UISearchController embedded. The searchBar of UISearchController is placed in MyModalView.tableView.tableHeaderView. It's been working fine since iOS 8.0. However on iOS 9, the searchBar disappear when the UISearchController is active. Please take a look at theses pictures below The modal view: UISearchController active on iOS 8: UISearchController active on iOS 9: The very standard code: override func viewDidLoad() { super.viewDidLoad() // Dynamically create a search controller using

Show search bar in navigation bar without scrolling on iOS 11

假装没事ソ 提交于 2019-11-28 04:03:55
I’m attaching a UISearchController to the navigationItem.searchController property of a UITableViewController on iOS 11. This works fine: I can use the nice iOS 11-style search bar. However, I’d like to make the search bar visible on launch. By default, the user has to scroll up in the table view to see the search bar. Does anyone know how is this is possible? Left: default situation after launch. Right: search bar made visible (by scrolling up). I’d like to have the search bar visible after launch, as in the right screenshot. I already found that the search bar can be made visible by setting

How do I use UISearchController in iOS 8 where the UISearchBar is in my navigation bar and has scope buttons?

。_饼干妹妹 提交于 2019-11-27 19:42:19
I'm trying to use the new UISearchController from iOS 8, and embed its UISearchBar in my UINavigationBar . That's easily done as follows: searchController = UISearchController(searchResultsController: nil) searchController.searchResultsUpdater = self searchController.delegate = self searchController.searchBar.delegate = self searchController.dimsBackgroundDuringPresentation = false searchController.hidesNavigationBarDuringPresentation = false navigationItem.titleView = searchController.searchBar But when I add the scope buttons: searchController.searchBar.showsScopeBar = true searchController