我已經使用UISearchController和表視圖實現了一個搜索屏幕。當我開始搜索某些內容時,搜索控制器會在表視圖頂部添加一個視圖(儘管它什麼都不做),並且在我設置searchController.active = false之前,VoiceOver無法訪問表視圖。我已經嘗試了幾乎所有的東西,唯一的解決方案是放棄UISearchController for UISearchBar。目前,一旦顯示鍵盤並且搜索控制器處於活動狀態,VoiceOver選擇器將從文本字段轉到條形按鈕項目,然後跳過表格視圖並轉到鍵盤。這是我的UISearchController的設置。UISearchController無法訪問
searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.delegate = self
searchController.hidesNavigationBarDuringPresentation = false
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.searchBarStyle = .Minimal
searchController.searchBar.keyboardAppearance = .Dark
searchController.searchBar.showsCancelButton = false
searchController.searchBar.delegate = self
searchController.searchBar.text = prefilledSearch
searchController.view.layer.borderColor = UIColor.redColor().CGColor
searchController.view.layer.borderWidth = 1.0
searchController.view.isAccessibilityElement = false
searchController.view.hidden = true
searchController.searchBar.setShowsCancelButton(false, animated: false)
我該如何解決這個問題並繼續使用UISearchController?目前,搜索功能無法在我的應用中與VoiceOver用戶使用。
在斯威夫特,你可以做 'FUNC didPresentSearchController(_ searchController:UISearchController){? searchController.view.superview .accessibilityViewIsModal =假 }' – Maximilian
@Maximilian這沒」 t在發佈這個答案時爲我工作。 – Andy