uisearchcontroller

Positioning of scope bar in UISearchController

泪湿孤枕 提交于 2019-12-12 03:22:22
问题 I'm developing a iPad-only app, and I've got a UITableView inside a UIViewController. I setted a UISearchController as the header of the UITableView. This search control has three scopes. I want the scope selector to be below the search bar . With the following piece of code, I'm able to get it at init, but when I start with the input, the selector goes to the right, and remains there . Here is an animation: And here is the relevant code: self.searchController = [[UISearchController alloc]

How to filter object array in updateSearchResultsForSearchController when using UISearchController?

只愿长相守 提交于 2019-12-12 00:54:59
问题 My search controller class is as following: class FeastSearchTableViewController: UITableViewController, UISearchResultsUpdating { var feastEntries = [FeastEntry]() var filteredFeasts = [FeastEntry]() /* let tableData = ["One","Two","Three","Twenty-One"] var filteredTableData = [String]()*/ var resultSearchController = UISearchController() override func viewDidLoad() { super.viewDidLoad() self.resultSearchController = ({ let controller = UISearchController(searchResultsController: nil)

Navigation bar + Search controller + Large title: Hairline during scrolling

做~自己de王妃 提交于 2019-12-11 18:35:31
问题 Context: UINavigationController with a UITableViewController UISearchController in the navigation bar Navigation bar translucent with black style, it uses large title, tintColor , barTintColor (so no background image). Issue: I have a strange animation glitch that shows a hairline above the search bar. The hairline appears only during the scroll. I have already tried many solutions concerning similar problems, but they have not helped. Tested with an iPhone 7 with iOS 12.1.3 回答1: You can fix

Hidden StatusBar reappears when SearchBar gets activated

蓝咒 提交于 2019-12-11 16:49:51
问题 I have a simple app with a TableView but without a NavigationBar/NavigationController. The app also has a UISearchController with a SearchBar that is always visible. I tried to hide the status bar with prefersStatusBarHidden and that works fine. Until the SearchBar is activated. Then the status bar will appear again. How can I prevent this and keep the status bar hidden? var cityRepository:CityRepository? var searchController:UISearchController? override func viewDidLoad() { self

xcode Loading a text string into a UISearchController

徘徊边缘 提交于 2019-12-11 11:09:52
问题 I was using this example for searching through a UICollectionView: https://github.com/ihomam/CollectionViewWithSearchBar/blob/master/collevtionViewWithSearchBar/CollectionViewController.m - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; // Configure the cell if (self.searchBarActive) { cell

Animate UISearchBar and UIBarButtonItem simultaneously with UISearchController

[亡魂溺海] 提交于 2019-12-11 10:39:51
问题 I'm trying to reproduce a search interface similar to the one of the Maps app. I'm using a UISearchController with its searchBar inside my navigationBar . I also have a rightBarButtonItem on that navigation bar. By default, when presenting the search controller, the cancel button of the search bar shows next to the existing right item. What I want to do — like with the Maps app — is to hide my right navigation item while the searchController is presented and show it again when it's dismissed.

3d Peek & Pop for search results

十年热恋 提交于 2019-12-11 08:49:34
问题 I use a Search Bar to filter my Table View. I display the search results in the same view controller that displays the searchable content. It works fine. Except one thing - 3d Peek and Pop is not working for the search results . I did tried the ‘Peek & Pop’ check box in Storyboard segue. I did tried programming peek & pop in my TableViewController. Result is the same: peek & pop works for table view cells but not for search result cells. Here is the search and peek & pop code pieces: // Add a

Swift searchBar separates from top of tableView after searchController.active during rotation

感情迁移 提交于 2019-12-11 06:59:34
问题 //Why does the tableView containing the searchResults array, after rotation to landscape and back to portrait, push the top of the tableView down thus separating the searchBar from the top of the tableView. This occurs repeatedly after each rotation to landscape and back. This only occurs after a search is instituted. It does not happen on rotation if the searchController is not active. class InitialViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

How to dismiss a ViewController while the navigationItem's searchBar has focus

百般思念 提交于 2019-12-11 06:19:57
问题 I updated my app to handle the new iOS 11 search behavior for search bars under the navigation bar: - (void)viewDidLoad { [super viewDidLoad]; UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.navigationItem.searchController = searchController; // Those are optional, but that's what I want my UI to look like searchController.hidesNavigationBarDuringPresentation = NO; searchController.obscuresBackgroundDuringPresentation = NO; self

Can I use a UISearchController with a storyboard?

江枫思渺然 提交于 2019-12-11 04:45:03
问题 Is there a way to use UISearchController in a way that lets me storyboard the UISearchBar ? I have a storyboarded UI with a navigation bar which contains my search bar. It would be great if I could keep it this way because setting up the layout programmatically would be really inconvenient. I know the old UISearchDisplayController could be storyboarded. Is there a way to do something similar with UISearchController? 回答1: Add a UIView to your layout. That will be the container for your