我希望更改 iOS 中取消按钮的标题。我以前一直在使用这个:
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{
self.searchDisplayController.searchBar.showsCancelButton = YES;
UIButton *cancelButton = nil;
for (UIView *subView in self.searchDisplayController.searchBar.subviews) {
if ([subView isKindOfClass:NSClassFromString(@"UIButton")]) {
cancelButton = (UIButton*)subView;
}
}
[cancelButton setTitle:@"Annuller" forState:UIControlStateNormal];
}
但它似乎不适用于iOS7。有什么建议么?