View got hidden below UINavigationBar iOS 7

前端 未结 9 1593
粉色の甜心
粉色の甜心 2020-12-02 13:10

Earlier, I was using iOS 6.1 for my project. Recently I have switched to iOS 7. For, a lot of changes I knew, I updated my code.. But I have observed a strange behavior. My

9条回答
  •  囚心锁ツ
    2020-12-02 13:15

    For me the best way for transparent Navigation Bar is to change the shadowImage and backgroundImage of the bar.

    navigationController?.navigationBar.isTranslucent = true
    navigationController?.navigationBar.backgroundColor = nil
    navigationController?.navigationBar.setBackgroundImage(UIImage(named: "navBarBackground")?.resizableImage(withCapInsets: .zero, resizingMode: .stretch), for: .default)  
    navigationController?.navigationBar.shadowImage = UIImage()
    

提交回复
热议问题