本文介绍了UISearchController更改“取消”按钮标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们如何更改搜索控制器中取消按钮的标题?
How we can change the title of cancel button in search controller?
推荐答案
您可以使用此更改搜索栏中的取消按钮 -
You can change the "Cancel" Button in search bar using this-
for (UIView *view in searchBar.subviews)
{
for (id subview in view.subviews)
{
if ( [subview isKindOfClass:[UIButton class]] )
{
[subview setEnabled:YES];
UIButton *cancelButton = (UIButton*)subview;
[cancelButton setTitle:@"hi" forState:UIControlStateNormal];
NSLog(@"enableCancelButton");
return;
}
}
}
这篇关于UISearchController更改“取消”按钮标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!