Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Supplymentary标题视图未采用状态栏集合视图_Ios_Swift_Uicollectionview_Header_Cell - Fatal编程技术网

Ios Supplymentary标题视图未采用状态栏集合视图

Ios Supplymentary标题视图未采用状态栏集合视图,ios,swift,uicollectionview,header,cell,Ios,Swift,Uicollectionview,Header,Cell,我使用辅助HeaderView使用集合视图创建此屏幕。我想将此HeaderView设置为状态栏。我为状态栏设置了清晰的颜色,但它不工作。请帮助我。我认为您需要进行下一步,删除此视图并将此图像放在导航栏的后面,下一步是将导航栏透明,并将色调颜色设置为白色,如下所示: self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) self.navigationController?.navi

我使用辅助HeaderView使用集合视图创建此屏幕。我想将此HeaderView设置为状态栏。我为状态栏设置了清晰的颜色,但它不工作。请帮助我。

我认为您需要进行下一步,删除此视图并将此图像放在导航栏的后面,下一步是将导航栏透明,并将色调颜色设置为白色,如下所示:

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = .clear
self.navigationController?.navigationBar.tintColor = UIColor.white

您可以尝试更早地启动集合视图的内容

collectionView.contentInset.top = -14

因此,首先在info.plst中点击“+”按钮,然后点击这一行。

而不是在UIViewController中添加此方法

override var prefersStatusBarHidden: Bool {
    return true
}

状态栏将仅在此viewController中隐藏。

是否要隐藏状态栏?@AlexanderKolovatov如果我隐藏状态栏,则我的标题视图将在状态栏中占据位置?是的,标题原始值将等于0。如果您需要一个代码示例,我可以为您编写。好的,然后给我解决方案,我将在@AlexanderKolovatov尝试