iOS 13 strange search controller gap

前端 未结 12 1757
无人共我
无人共我 2021-02-01 14:55

When running the App on iOS 13 beta 6, using Xcode 11 beta 5 I\'m encountering the strange gap when presenting search results view controller:

Here\'s a bit o

12条回答
  •  鱼传尺愫
    2021-02-01 15:36

    Just bringing my solution. In my case:

    edgesForExtendedLayout = .all
    

    on the UIViewController that contains the UISearchController worked.

    //MARK: - Properties
    var presenter: ExplorePresenting?
    var searchController: UISearchController?
    var searchUpdater: SearchUpdating?
    
    
    //MARK: - Lifecycle methods
    public override func viewDidLoad() {
        super.viewDidLoad()
    
        headerTitle = "explore".localised
        tableView.allowsSelection = false
        registerCell(cellClass: ExploreTableViewCell.self, with: tableView)
    
        if let searchController = searchController {
    
            searchController.searchBar.delegate = self
            searchController.searchResultsUpdater = self
            searchController.obscuresBackgroundDuringPresentation = false
            searchController.searchBar.placeholder = "explore_search_placeholder".localised
    
            definesPresentationContext = true
            navigationItem.hidesSearchBarWhenScrolling = false
            navigationItem.searchController = searchController
            edgesForExtendedLayout = .all
    
        }
    
        presenter?.viewReady()
    
    }
    

提交回复
热议问题