iOS Change the title of cancel button in UISearchBar

前端 未结 13 1924
隐瞒了意图╮
隐瞒了意图╮ 2020-12-28 10:35

I wish to change the title of the cancel button in iOS. I have been using this previously:

- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayCon         


        
13条回答
  •  情书的邮戳
    2020-12-28 11:10

    If you just want to change the "Cancel" text to the same in your locale, the proper way I think is using localization. Here is how:

    1. open your project in the Finder, locate the en.lproj directory
    2. rename it to your locale, or duplicate it if you have to support multiple languages
    3. remove any file references it may have contained in Xcode (they should look red)
    4. drag the same files from Finder from the new directory to Xcode
    5. (not sure this is necessary) edit your Info.plist and add these lines:

      • Localization native development region: your region (for example: en)
      • Localizations: for example English

    Note: it does not work in Simulator, test it on the device!

    (Source: http://www.ibabbleon.com/iphone_app_localization.html)

提交回复
热议问题