0

I have a navigation bar which is transparent and a tableView in my view.

What I want to do is to fill the all part of navigation and status bar with my first cell and remove the top margin.

Like this enter image description here

But now it looks like this.

enter image description here

Thank you.

  • Possible dublicate https://stackoverflow.com/questions/25845855/transparent-navigation-bar-ios – DionizB Nov 16 '18 at 16:00
  • 2
    Possible duplicate of [transparent navigation bar ios](https://stackoverflow.com/questions/25845855/transparent-navigation-bar-ios) – DionizB Nov 16 '18 at 16:01
  • My navigation bar is already transparent. But default position of first cell is not what I want for... Even if I set the tableView's constraint to the superView, it is always under the bottom of navigation bar. – Kawabe Imagine Nov 16 '18 at 16:11
  • I'm not sure but you can try to set `contentInset` of the `tableView` up to top of the screen – Tung Vu Duc Nov 16 '18 at 16:15

1 Answers1

0
let yOffset = UIApplication.shared.statusBarFrame.height + self.navigationController!.navigationBar.frame.size.height
tableView.contentInset = UIEdgeInsets(top: -yOffset, left: 0, bottom: 0, right: 0)

This solved my problem. Thank you everyone!