tableview 头部视图是UISearchBar,当点击搜索框进行搜索的时候,搜索条和状态条的颜色不统一,

图片描述

这个是我的搜索框开始搜索时候,状态栏的颜色怎么不是搜索框的底色,我这里的要求是开始搜索的时候,状态栏的颜色和搜索框的底色要一样,这是为什么,

 _discoverTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_discoverTableView.separatorStyle = UITableViewCellSelectionStyleNone;
_discoverTableView.backgroundColor = [UIColor whiteColor];
_discoverTableView.delegate = self;
_discoverTableView.dataSource = self;
_discoverTableView.showsVerticalScrollIndicator = NO;
[self.view addSubview:_discoverTableView];
[_discoverTableView makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.view).offset(-NaviBarHeight);
    make.left.equalTo(@0);
    make.size.mas_equalTo(CGSizeMake(ScreenWidth, ScreenHeight-ViewCtrlTopBarHeight));
}];

self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, NaviBarHeight)];
self.searchBar.placeholder = NSLocalizedString(@"search", nil);
self.searchBar.delegate = self;
_discoverTableView.tableHeaderView = self.searchBar;

这是我的代码实现,

阅读 6.4k
1 个回答

self.navigationController.view.backgroundColor = 你searchBar的颜色

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题