uisearchcontroller

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

How to change background color of the text field in the UISearchController?

冷暖自知 提交于 2019-12-19 03:08:21
问题 How to change the default grey background at UISearchController search text field? 回答1: Here is a an example on how to set the textField background. class ViewController: UIViewController { let searchController = UISearchController(searchResultsController: nil) private lazy var searchTextField: UITextField? = { [unowned self] in var textField: UITextField? self.searchController.searchBar.subviews.forEach({ view in view.subviews.forEach({ view in if let view = view as? UITextField { textField

UISearchController makes the controller black

纵饮孤独 提交于 2019-12-18 19:47:23
问题 I am using UISearchController in iOS 8 with the following intializaiton in viewDidLoad of a view controller embedded in a tab controller _searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; _searchBar = _searchController.searchBar; [_searchController.searchBar sizeToFit]; _searchController.searchBar.delegate = self; _searchController.searchResultsUpdater = self; _searchController.dimsBackgroundDuringPresentation = NO; _searchController

UISearchBarController iOS 11 issue - SearchBar and scope buttons overlap

大憨熊 提交于 2019-12-18 19:29:12
问题 Referred here and here. No answer in first link. In the second link, though the answer is not accepted, but the link to apple developer forum gives error. Before iOS 11 : iOS 11 : Note : Same device same code. Also, this would mean, all apps using this feature have to be republished ? 回答1: Adding these lines fixed it for me: override func viewDidLayoutSubviews() { self.searchController.searchBar.sizeToFit() } 回答2: I can get the initial appearance to display correctly in iOS11 using the

UISearchBar custom corners

纵饮孤独 提交于 2019-12-18 15:13:34
问题 I'm trying to create a search bar like this: But I'm noticing that I'm probably going to have to replace the search bar with my own image because the search bar corners comes out wrong when I set: self.searchController.searchBar.layer.cornerRadius = 50 // I've tried other numbers besides this too with no luck self.searchController.searchBar.clipsToBounds = true If I set this: self.searchController.searchBar.layer.cornerRadius = self.searchController.searchBar.bounds.height/2 The search bar

How can I use queryStartingAtValue in my searchcontroller to search for users?

谁说胖子不能爱 提交于 2019-12-18 09:48:43
问题 I have previously asked a question about searching for users the most cost-efficient way (without having to load up every user in the entire database. My code before the question was class FollowUsersTableViewController: UIViewController{ @IBOutlet var tableView: UITableView! private var viewIsHiddenObserver: NSKeyValueObservation? let searchController = UISearchController(searchResultsController: nil) var usersArray = [UserModel]() var filteredUsers = [UserModel]() var loggedInUser: User? //

UISearchController searchBar frame only resizes on first click

强颜欢笑 提交于 2019-12-18 09:08:51
问题 I have just implemented a UISearchController in a regular UIViewController, and I have a kind of weird issue. I have a UIView that is adapted exactly to the size I want my UISearchBar to take. On first launch of the view, I add my UISearchBar as a SubView to this UIView. But when I launch it, the UISearchBar doesn't take the size of its parent UIView -- it just takes the width of the whole screen. As you can see, it overlaps with the button on the right. But once I click on the search bar and

Deleting from UISearchController's filtered search results

大城市里の小女人 提交于 2019-12-18 05:46:10
问题 I have a tableView sourcing its cell content from CoreData and have been replacing the SearchDisplayController (deprecated) with the new SearchController . I am using the same tableView controller to present both the full list of objects and also the filtered/searched objects. I have managed to get the search/filtering working fine and can move from the filtered list to detail views for those items, then edit and save changes back successfully to the filtered tableView. My problem is swiping

Display UISearchController's searchbar programmatically

。_饼干妹妹 提交于 2019-12-18 04:14:46
问题 Note 1: This question pertains to adding a UISearchController's search bar outside of the table view it updates - NOT as the table view's header. Note 2: Some trial and error led me to a solution. Please see my answer below. I am new to iOS development and am struggling to work with the UISearchController class. I have a view controller, and in my view controller's view, I plan to have a search bar above a table view. I would like the search bar to be linked to a UISearchController. Since

Implement UISearchController with UITableView

半城伤御伤魂 提交于 2019-12-17 21:09:06
问题 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! 回答1: UISearchDisplayController has been deprecated and replaced by UISearchController .And it is available in iOS 8.0 and later.