UITableView is under the TabBar

前端 未结 7 2053
花落未央
花落未央 2021-01-24 20:57

I have a custom UITableView with custom cells (70px height for each cell).

I have also a 49px UITabBar, but it\'s hides the tableView.

7条回答
  •  暖寄归人
    2021-01-24 21:32

    I ran into this issue when dealing with a table view in a navigation controller that did not have translucent bars. I performed a setup similar to the following:

    override func viewDidLoad() {
        super.viewDidLoad()
    
        // Without this there is some extra fast inertia when slowly
        // scrolling to the top.
        extendedLayoutIncludesOpaqueBars = true
    
        // Don't extend the tableview past the bottom bar, though.
        // If we do then a tab bar or bottom nav bar will block
        // content.
        edgesForExtendedLayout = [.top, .left, .right]
    }
    

    However, I later discovered that a couple of checkboxes were unchecked in a storyboard higher up the hierarchy. Specifically these two:

    Checking these two boxes removed the need to care about the content insets and the layout extending behavior in that view controller

提交回复
热议问题