在iOS 8中更改UISearchBar取消按钮文本 [英] Change UISearchBar cancel button text in iOS 8
本文介绍了在iOS 8中更改UISearchBar取消按钮文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在iOS 8中的UISearchBar中更改取消按钮的取消字样。我正在使用UISearchController。我尝试过针对iOS 6和iOS 7的不同方法,但它们不起作用。有没有人这样做过?
I'd like to change the text from ¨Cancel¨to ¨Done¨ of the Cancel button inside the UISearchBar in iOS 8. I am using UISearchController. I've tried different approaches for iOS 6 and iOS 7 and they do not work. Has anybody done this?
推荐答案
这将有效
[searchBar setValue:@"customString" forKey:@"_cancelButtonText"];
Swift版本:
searchBar.setValue("customString", forKey:"_cancelButtonText")
这篇关于在iOS 8中更改UISearchBar取消按钮文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文