How to override the cancel button in the UISearchBar

后端 未结 3 2021
难免孤独
难免孤独 2021-01-20 04:32

I am currently using the following method to stop the cancel button item from showing up in the search bar. I have a custom UIButton that I would like to use in

3条回答
  •  旧巷少年郎
    2021-01-20 04:42

    Swift 4.2, 4.0+ of Rajneesh071 answer

    func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
        searchBar.setShowsCancelButton(false, animated: true)
    }
    

提交回复
热议问题