小编Gri*_*ith的帖子

隐藏UISearchController中搜索栏上的"取消"按钮

我试图隐藏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)

这种方法有效但在隐藏之前会短暂显示取消按钮,这并不理想.有什么建议?

ios swift uisearchcontroller ios9

7
推荐指数
2
解决办法
9316
查看次数

标签<br/>对jquery不起作用?

$('#mybutton').click(function () {
    $('#id').text("this is my text " + "<br/>");
});
Run Code Online (Sandbox Code Playgroud)

这是我的jquery代码.单击按钮时mybutton,文本应更改为此.我现在的问题是<br/>标签不起作用.还有其他办法吗?谢谢.

javascript jquery text button

-1
推荐指数
1
解决办法
160
查看次数

标签 统计

button ×1

ios ×1

ios9 ×1

javascript ×1

jquery ×1

swift ×1

text ×1

uisearchcontroller ×1