0

如何在 iOS9 中的 tableViewController 中以最简单的方式停止从 UISearchBar 出现的取消按钮?

带有取消按钮的 UISearchBar

那里有很多替代答案,但在 iOS9 中没有简单的目标 C 答案。

4

2 回答 2

2

为了迅速,根据Ben的回答,

func didPresentSearchController(_ searchController: UISearchController) {
        searchController.searchBar.showsCancelButton = false
    }

并且不要忘记为您的搜索控制器设置委托。

searchController.delegate = self

希望这可以帮助。谢谢。

于 2018-11-26T08:00:48.480 回答
0
-(void) didPresentSearchController:(UISearchController *) searchController {
  self.searchController.searchBar.showsCancelButton = NO;
}
于 2015-09-23T09:34:36.573 回答