【发布时间】:2014-06-21 09:21:42
【问题描述】:
如果我添加我的 UISearchBar 而不将它引用到 UISearchDisplayController,我的 tintColor 会正确显示。
searchBar.barTintColor = [UIColor colorWithRed:200.0f/255.0f green:21.0f/255.0f blue:26.0f/255.0f alpha:1.0f];
但是如果我将我的 UISearchBar 引用到 UISearchDisplayController,颜色似乎不同...
searchBar = [[UISearchBar alloc] init];
[searchBar setBarTintColor:[UIColor colorWithRed:200.0f/255.0f green:21.0f/255.0f blue:26.0f/255.0f alpha:1.0f]];
searchBar.delegate = self;
searchBar.searchBarStyle = UISearchBarStyleProminent;
searchBar.placeholder = @"Buscar restaurantes o platillos";
searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
searchController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
searchController.delegate = self;
self.tableView.tableHeaderView = searchBar;
我的 AppDelegate 上的 tintColor 设置是
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:200.0f/255.0f green:21.0f/255.0f blue:26.0f/255.0f alpha:1.0f]];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
[[UIToolbar appearance] setBarTintColor:[UIColor colorWithRed:200.0f/255.0f green:21.0f/255.0f blue:26.0f/255.0f alpha:1.0f]];
self.window.tintColor = [UIColor whiteColor];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.backgroundColor = [UIColor colorWithRed:200.0f/255.0f green:21.0f/255.0f blue:26.0f/255.0f alpha:1.0f];
此外,当我的 UISearchBar 被引用到我的 UISearchDisplayController 并且我点击搜索字段时...在转换时状态栏的背景是白色的。
有什么想法吗?
我正在使用 iOS7
提前致谢!
【问题讨论】:
标签: ios cocoa-touch uisearchbar uisearchdisplaycontroller