Change UISearchBar cancel button text in iOS 8

后端 未结 13 1767
感动是毒
感动是毒 2020-12-13 01:48

I\'d like to change the text from "Cancel" to "Done" of the Cancel button inside the UISearchBar in iOS 8. I am using UISearchControll

13条回答
  •  无人及你
    2020-12-13 02:25

    In Swift4

    Change Title:

    (searchBar.value(forKey: "cancelButton") as! UIButton).setTitle("Done", for: .normal)

    Change Color:

    (searchBar.value(forKey: "cancelButton") as! UIButton).setTitleColor(UIColor.blue, for: .normal)

提交回复
热议问题