We have a UITableView
with a searchbar
added with the searchDisplayController
.
We want to have translucency off throughout the app.
I have the translucency off for the navigation bar and other bars, but not the search bar when it uses the display controller. In one part of the app when we use the search bar but not the display controller, the translucency is set correctly.
How can I set the translucent property of the UISearchBar
with the display controller to be NO?
EDIT:
this is my code in viewDidLoad
self.navigationController.navigationBar.translucent = NO;
BOOL t = self.searchDisplayController.searchBar.translucent;
self.searchDisplayController.searchBar.translucent = NO;
self.navigationController.navigationBar.barTintColor = [UIColor redColor];
self.searchDisplayController.searchBar.barTintColor = [UIColor redColor];
UIBarStyle b1 = self.searchDisplayController.searchBar.barStyle;
UISearchBarStyle b2 = self.searchDisplayController.searchBar.searchBarStyle;
BOOL t2 = self.searchDisplayController.searchBar.translucent;
Running in the debugger, t = YES and t2 = YES. b1 = UIBarStyleDefault
and b2 = UISearchBarStyleDefault
. Am I setting NO at the wrong spot? Ive tried the setting in the storyboard
and here in viewDidLoad
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…