0
私のアプリはユニバーサルデバイスをサポートする必要があります。iPadで検索バーの[キャンセル]ボタンが消える
そして、UISearchControllerを持つビューコントローラがあります。それはiPhoneデバイスでは正常に表示されますが、iPadでは「キャンセル」ボタンが消えます。
なお、以下、ビューコントローラにおける検索バー約関連するコードです。
func configureSearchController() {
self.collectionView!.updateConstraints()
resultsTableController = SearchBookResultTableViewController()
resultsTableController.tableView.delegate = self
searchController = UISearchController(searchResultsController: resultsTableController)
searchController.searchResultsUpdater = self
navigationItem.titleView = searchController.searchBar
searchController.searchBar.sizeToFit()
searchController.dimsBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchBar.delegate = self
searchController.searchBar.searchBarStyle = .Minimal
searchController.searchBar.placeholder = "书籍、作者、出版社"
// stress
searchController.searchBar.showsCancelButton = true
definesPresentationContext = true
}
私はこの問題の原因を知りたいのですが、どのように解決できるのでしょうか。
助けを求める!どうも。
これは推測です - (.sizeToFit前.showsCancelButtonを移動してみてください) –
@MikeTaverne私はあなたの方法を試して、問題がまだ終了します。 'showsCancelButton'プロパティは' true'です。デフォルトです。私はプロパティが本当であることを強調したい、それで私はそれを書く。 *>。<* –
iPadのキーボードに「キーボードの切捨て」ボタンがある場合、キャンセルボタンは実際には必要ありません。 – tktsubota