【发布时间】:2015-05-02 14:05:54
【问题描述】:
我在导航项的标题视图中添加了一个搜索栏。搜索正常,但使用导航控制器时,搜索栏的背景会改变颜色,如下所示
我唯一接触颜色的地方是通过 xcode 更改故事板中导航项的颜色
将搜索栏放入titleview的相关代码
_searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
[_searchController.searchBar sizeToFit];
self.navigationItem.titleView = _searchController.searchBar;
是什么导致了这种颜色?
尝试用
改变 bartint 颜色[_searchController.searchBar setBarTintColor:[UIColor clearColor]];
但我收到了这个
还有一些不工作的东西是
[_searchController.searchBar setBarTintColor:self.navigationController.navigationBar.tintColor];
_searchController.searchBar.backgroundColor = self.navigationController.navigationBar.tintColor;
和backgroundColor
似乎这种颜色与设置不同。用 redColor 看这里
【问题讨论】:
-
我试过clearColor,不行
-
如何制作像你上传的问题图片一样的gif图片?
-
我在 os x 上使用 LICEcap
标签: ios uinavigationcontroller uisearchbar