相关疑难解决方法(0)

搜索激活后,IOS7状态栏变为黑色

我正在使用UISearchBar作为UITableView的标头.UISearchBar样式是UISearchBarStyleMinimal.当搜索处于活动状态时,状态栏会变为黑色.如何解决?

在搜索激活之前

在搜索激活之前

搜索已激活

搜索已激活

iphone uisearchbar uisearchdisplaycontroller ios ios7

14
推荐指数
1
解决办法
5841
查看次数

UISearchController在调用时更改状态栏颜色

我在我的应用程序中有以下代码,特别是在viewDidLoad:设置我的UISearchController.

self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.hidesNavigationBarDuringPresentation = NO;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.definesPresentationContext = NO;
self.searchController.searchBar.scopeButtonTitles = @[];
self.searchController.searchBar.searchBarStyle = UISearchBarStyleProminent;

[_tableView setTableHeaderView:_searchController.searchBar];
Run Code Online (Sandbox Code Playgroud)

每当tableView调用搜索栏(添加到搜索栏)时,UIStatusBar颜色从UIStatusBarStyleLightContent暗变为白色(白色变为黑色).现在,我想出我是否设置,

self.definesPresentationContext = NO;
Run Code Online (Sandbox Code Playgroud)

以下内容:

self.definesPresentationContext = YES;
Run Code Online (Sandbox Code Playgroud)

问题得到解决,UIStatusBar颜色得以保留.但是,出现了另一个问题.当self.definesPresentationContext设置为YES ,在调用时,搜索栏由于某种原因向下移动,同时(或正确地)在UIRefreshControl显示器底部的下方tableView.

uitableview ios uistatusbar uirefreshcontrol uisearchcontroller

9
推荐指数
1
解决办法
6551
查看次数