uisearchcontroller

TableView with SearchController - DEINIT not called

自闭症网瘾萝莉.ら 提交于 2019-11-30 14:54:29
I have added a search bar and search display controller from the interface builder to my app. I am not able to get it to deinit (dealloc) properly. It is showing the following behavior (swift2, ios9): User doesn't search anything, just selects an item from tableView, DEINIT is called User searches something (or just taps in the search bar), cancel the search, select item from tableView, DEINIT is called User searches something (or just taps the search bar), and selects an item from tableView, DEINIT is NOT called :( The same behaviour occurs if I select "Back" in the navigation controller

UISearchController - Warning Attempting to load the view of a view controller

风格不统一 提交于 2019-11-30 14:02:06
问题 I am getting the following error. Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior () Tried the following solution , but does not work for me Attempting to load the view of a view controller while it is deallocating... UISearchController A demo project is available at the link. Tap add button in Master controller, add few time-stamps. Switch between rows of the Master view controller and you will see the above error.

UISearchBar custom corners

隐身守侯 提交于 2019-11-30 13:00:47
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 comes out like this: Which still isn't exact like in the image. Is there a way to replace the left and

UISearchController: show results even when search bar is empty

给你一囗甜甜゛ 提交于 2019-11-30 10:57:14
问题 As I understand, the default behaviour of UISearchController is: On tapping search bar, background is dimmed and 'cancel' button is shown. SearchResultsController is not shown till this point. SearchResultsController is displayed only if search bar is not empty. I want to display SearchResultsController even when search bar is empty but selected (i.e is case 1 above). Simply put, instead of background dimming, I would like to show Search results. Is there a way for doing this? More

Cancel Button in UISearchController

人盡茶涼 提交于 2019-11-30 07:53:53
问题 In my project I'm using a UITableViewController with an internal UISearchController to filter the data in my tableView . I have no problem to filter the data but I need to make a date of my tableView reload when I click on the CANCEL button UISearchController but I can not find the delegate method for this ... Can you help me understand how to solve this problem? 回答1: You need to set the UISearchController searchBar's delegate . Once you have done this, the addition of the delegate method

Fixed UISearchBar using UISearchController - Not using header view of UITableView

会有一股神秘感。 提交于 2019-11-30 06:32:28
问题 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. 回答1: You can place

Search bar jumps down one row every time cancel button is tapped

回眸只為那壹抹淺笑 提交于 2019-11-30 03:53:20
问题 I have implemented a UISearchBar to search through a catalogue of items from an external API. The Search functionality works as expected, however the problem is that every time I press the cancel button, which is on the right side of the search bar text field, the whole search bar moves down by one row and it looks like it pushes the entire table view down as well. So if I type a letter into the search bar text field, then press cancel, the search bar text field moves down by 44px, which is

UISearchController in a UIViewController

拥有回忆 提交于 2019-11-30 03:42:01
I'm looking to create similar functionality to Apple's maps application in Swift. Is there anyway to integrate a UISearchController in to a regular view (i.e.: not a UITableView). Dropping one in through Storyboard results in a crash after clicking inside the connected searchbar. Or is there some way I can achieve this outcome with a UITableView? I added a Search Bar and Search Display Controller in my View Controller in the storyboard. The view controller contains only the search bar and search display controller and does not have it's own TableView. When you add the search bar in your view

UISearchController searchBar in tableHeaderView animating out of the screen

半腔热情 提交于 2019-11-30 02:53:29
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 the position of the UINavigationBar (y: 0), it jumps out of the screen and than starts the animation

Show UISearchController's SearchResultsController on SearchBar Tap

て烟熏妆下的殇ゞ 提交于 2019-11-29 23:49:33
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): 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: self.searchController.delegate = self; Implement willPresentSearchController: in your ViewController: - (void