在IOS搜索栏我能够添加取消图像和删除文本,但一个问题是当我searchBar酒吧色调清晰后,我的图像不显示,我必须清除在UI
色彩条的颜色我要在搜索栏添加图像取消按钮 这里是我的代码ios搜索栏能够添加取消图像,但不正确
-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{
self.searchDisplayController.searchBar.showsCancelButton = YES;
UIButton *cancelButton;
UIView *topView = self.searchDisplayController.searchBar.subviews[0];
for (UIView *subView in topView.subviews) {
if ([subView isKindOfClass:NSClassFromString(@"UINavigationButton")]) {
cancelButton = (UIButton*)subView;
}
}
if (cancelButton) {
//Set the new title of the cancel button
[cancelButton setTitle:@" " forState:UIControlStateNormal];
// [cancelButton setBackgroundColor:[UIColor redColor]];
[cancelButton setImage:[UIImage imageNamed:@"close_icon.png"] forState:UIControlStateNormal];
}
}
清除色彩条的颜色后
请给我解决方案............... 是否有希望请帮帮我........... 请帮忙,有没有5天完成和我没有任何解决方案
您是否解决了此问题? – 2016-11-28 06:59:47