How to change the default text of Cancel Button which appears in the UISearchBar +iPhone

后端 未结 15 1983
慢半拍i
慢半拍i 2020-12-01 03:04

I am developing an Application where I wanted to change the text of Search String in the SearchBar. I wanted to change the text of Cancel Button Also which appears next to t

15条回答
  •  渐次进展
    2020-12-01 03:23

    Instead of referencing the non-public UINavigationButton class, I did the following. I'm hoping that it will make it through App Store review!

    for (id subview in searchBar.subviews) {
        if ([subview respondsToSelector:@selector(setTitle:)]) {
            [subview setTitle:@"Map"];
        }
    }
    

提交回复
热议问题