Tab bar covers UITableView's last cell

后端 未结 12 1873
挽巷
挽巷 2020-12-16 01:18

I\'m developing an application based on the Tab Bar application preset. In one of the tabs I have a table view showing a lot of data, but half the last cell in the table vie

12条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 01:52

    Swift 3:

    This is what worked perfectly for me. This code not only stop the last cell showing behind the tab bar, but also pushes up the scroll indicator. Put the code in your viewDidLoad():

    if let rect = self.navigationController?.tabBarController?.tabBar.frame {
        let y = rect.size.height
        tableView.contentInset = UIEdgeInsetsMake( 0, 0, y, 0)
        tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, y, 0)
    }
    

提交回复
热议问题