问题描述
我有一个应用程序,整个 UI 都带有蓝色主题.我在初始视图的导航栏中也有一个嵌入式搜索栏.我的应用程序按钮文本颜色为白色,并在应用程序委托中声明:
I have an app that has a blue tint theme to the entire UI. I also have an embedded search bar in the Navigation Bar on my initial view. My button text color for the app is white and declare that in the app delegate using:
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
问题是这会导致嵌入式搜索栏在选择光标时隐藏光标,因为白色色调会影响搜索栏.我尝试使用两种方法专门将搜索栏的色调设置为 [UIColor blueColor],但没有运气.我尝试引用 UISearch 栏的两种方法是:
Problem is that this causes the embedded search bar to hide the cursor when it is selected because of the white tint affecting the search bar. I have tried to specifically set the tint of the search bar to [UIColor blueColor] using two methods but have had no luck. The two ways I have tried to refrence the UISearch bar are:
[self.navigationController.searchDisplayController.searchBar setTintColor:[UIColor blueColor]];
和
[searchBar setTintColor:[UIColor blueColor]]
应该正确引用searchBar.
The searchBar should be referenced properly.
我对这些网点所做的一切都不会影响嵌入式搜索栏.
Nothing I do to these outlets affect the embedded search bar at all.
推荐答案
遇到了同样的问题.将搜索栏嵌入导航栏后使用此代码解决.
Had the same problem. Solved it by using this code after embedding the search bar into navigation bar.
self.navigationItem.titleView.tintColor = [UIColor blueColor];
可能不是最好的解决方案,但它确实有效.
Probably not the best solution, but it works.
这篇关于在导航栏中为嵌入式 UISearchbar 设置色调颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)