UISearchDisplayController Light而不是Dark

时间:2013-11-13 04:10:21

标签: ios

如何将UISearchDisplayController更改为浅而不是黑暗?现在我的应用程序是这样的:

dark

音乐应用程序是这样的(首选):

light

我找不到任何相关属性或什么来改变色调颜色。这是我的相关代码:

UISearchBar *searchBar = [[UISearchBar alloc] init];
[searchBar setDelegate:self];
[searchBar setSearchBarStyle:UISearchBarStyleMinimal];
[searchView addSubview:searchBar];
[self setSearchBar:searchBar];

UISearchDisplayController *searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
[searchDisplayController setDelegate:self];
[searchDisplayController setSearchResultsDelegate:self];
[searchDisplayController setSearchResultsDataSource:self];
[self setSearchBarDisplayController:searchDisplayController];

2 个答案:

答案 0 :(得分:0)

试试这样, 将 StatusBarStyle 更改为 UIStatusBarStyleDefault &此代码显示为您所期望的。

enter image description here

UISearchBar *searchBar = [[UISearchBar alloc] init];
[searchBar setFrame:CGRectMake(0.0, 20.0, 320.0, 44.0)];
[searchBar setShowsCancelButton:YES];
[searchBar setTintColor:[UIColor redColor]];
[searchBar setPlaceholder:@"Search here."];
[searchBar setSearchBarStyle:UISearchBarStyleMinimal];
[searchBar setBarStyle:UIBarStyleDefault];
[self.view addSubview:searchBar];

答案 1 :(得分:0)

看起来这是我设置的一些UINavigationBar外观属性的问题。删除并更改后,导航栏现在看起来正常。