UITableView goes under translucent Navigation Bar

前端 未结 14 1101
一整个雨季
一整个雨季 2020-12-22 23:51

I am trying to have a transparent navigation bar in IOS 7 app. There is a full screen image in my application. I am also having a UITableView over that image. When I use the

14条回答
  •  猫巷女王i
    2020-12-23 00:21

    Constrain the table view to the bottom of the navigation bar. The table view will automatically be offset by 44, but then in code we can just do this:

    tableView.contentInset = UIEdgeInsets(top: -44, left: 0, bottom: 0, right: 0)
    

    The bar is transparent and has no color, but the table view does not overlap it at all. Notice the word "Hook" gets cut off despite the navigation bar being transparent. This will only work of you constrain the table view top edge to be 0 from the navigation bar. NOT 0 from the top view.

提交回复
热议问题