How do I make my iOS7 UITableViewController NOT appear under the top status bar?

前端 未结 13 2041
旧巷少年郎
旧巷少年郎 2020-12-13 14:04

My root controller is a TabBarController (tabbed application). One of the tabs, is a UITableViewController. When I switch to that and scroll through the items, they show up

13条回答
  •  时光取名叫无心
    2020-12-13 14:40

    suppose your table's @IBOutlet is

     @IBOutlet var tableView: UITableView!
    

    create a function prepareTable(). add the below line into that method

    tableView.contentInset.top = UIApplication.shared.statusBarFrame.height
    

    call this method from ViewDidLoad()

提交回复
热议问题