使用 UISearchController 时如何使状态栏透明
How to make status bar transparent when using UISearchController
我正在创建我自己的自定义 UISearchBar 和 UISearchController,在 this tutorial 之后,我想使用 searchBar.setBackgroundImage() 添加我自己的背景,但问题是图像没有跨越状态酒吧也是如此。所以我得到一个白色的状态栏,看起来像这样:
有人知道如何解决这个问题吗?
设置图像视图"top space to superview" = -20.
谢谢
你的捐赠 link 项目已实施:
先去main.storyboard设置tableview y position = 0后删除tableview top的约束并设置tableview的top约束。
您在 viewcontroller.swift 文件中设置的搜索栏视图高度。
试试这个:
UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)
我正在创建我自己的自定义 UISearchBar 和 UISearchController,在 this tutorial 之后,我想使用 searchBar.setBackgroundImage() 添加我自己的背景,但问题是图像没有跨越状态酒吧也是如此。所以我得到一个白色的状态栏,看起来像这样:
有人知道如何解决这个问题吗?
设置图像视图"top space to superview" = -20.
谢谢
你的捐赠 link 项目已实施:
先去main.storyboard设置tableview y position = 0后删除tableview top的约束并设置tableview的top约束。
您在 viewcontroller.swift 文件中设置的搜索栏视图高度。
试试这个:
UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)