我试图隐藏UISearchController中搜索栏的"取消"按钮,但不幸的是在viewDidLoad()中设置以下内容不起作用:
override func viewDidLoad() {
super.viewDidLoad()
searchResultsTableController = UITableViewController()
searchResultsTableController.tableView.delegate = self
searchController = UISearchController(searchResultsController: searchResultsTableController)
searchController.searchResultsUpdater = self
searchController.searchBar.sizeToFit()
searchResultsView.tableHeaderView = searchController.searchBar
searchController.delegate = self
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.delegate = self
searchController.searchBar.searchBarStyle = .Minimal
searchController.searchBar.showsCancelButton = false
definesPresentationContext = true
}
Run Code Online (Sandbox Code Playgroud)
我也试过在这个委托方法中使用上面的代码:
func didPresentSearchController(searchController: UISearchController) {
searchController.searchBar.showsCancelButton = false
}
Run Code Online (Sandbox Code Playgroud)
这种方法有效但在隐藏之前会短暂显示取消按钮,这并不理想.有什么建议?
$('#mybutton').click(function () {
$('#id').text("this is my text " + "<br/>");
});
Run Code Online (Sandbox Code Playgroud)
这是我的jquery代码.单击按钮时mybutton,文本应更改为此.我现在的问题是<br/>标签不起作用.还有其他办法吗?谢谢.