如何将UISearchBar上"Cancel"按钮改为”取消“
1个回答
2016-07-22
展开全部
这个是不需要修改的,在工程的localizations添加中文即可。
UIButton *cancelButton;
UIView *topView = self.subviews[0];
for (UIView *subView in topView.subviews) {
if ([subView isKindOfClass:NSClassFromString(@"UINavigationButton")]) {
cancelButton = (UIButton *)subView;
}
}
if (cancelButton) {
[cancelButton setTitle:@"取消" forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
}
UIButton *cancelButton;
UIView *topView = self.subviews[0];
for (UIView *subView in topView.subviews) {
if ([subView isKindOfClass:NSClassFromString(@"UINavigationButton")]) {
cancelButton = (UIButton *)subView;
}
}
if (cancelButton) {
[cancelButton setTitle:@"取消" forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询