我需要自定义 UISearchBar:
- 更改搜索文本颜色
- 更改网站图标
Apple 没有提供 API。但是,这是一种可能的解决方案:
for(UIView *subView in _searchBar.subviews){
if([subView isKindOfClass:UITextField.class]){
UITextField *searchField = (UITextField*)subView;
searchField.textColor = [UIColor darkGrayColor];
UIImage *image = [UIImage imageNamed: @"loop.png"];
UIImageView *iView = [[UIImageView alloc] initWithImage:image];
searchField.leftView = iView;
}
}
它完美地工作。但我担心苹果可能会拒绝该应用程序。我知道这不是私有 API,但也不是完全公开的。
有没有人在 App Store 中有这样的代码的应用程序?