黑色导航栏覆盖集合视图标题中的图像视图

时间:2018-06-26 21:02:35

标签: ios swift xcode uinavigationcontroller imageview

我有一个集合视图标题,其背景包含图像。我想做的是允许图像成为导航控制器的背景。

  

我现在拥有的东西
  Current



  

这就是我要实现的目标   What i am trying to achieve

到目前为止,我已经尝试了很多方法。我使导航栏为半透明。我调整了边缘的扩展布局,并将导航控制器的属性设置为不透明的条形。

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(true)
    navigationController?.navigationBar.isHidden = false
    navigationController?.navigationBar.isTranslucent = true
    tabBarController?.tabBar.isHidden = false
    tabBarController?.tabBar.barTintColor = UIColor.white
    tabBarController?.tabBar.tintColor = UIColor.lightWetAsphalt
    self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
    self.navigationController!.navigationBar.shadowImage = UIImage()
    self.navigationController?.navigationBar.backgroundColor = UIColor.clear
    self.edgesForExtendedLayout = []
    collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.never
}



注意:如果我隐藏了导航控制器,则图像视图将在状态栏下完美显示。出于某种原因,当我不隐藏导航栏时,即会显示该黑色视图

0 个答案:

没有答案
相关问题