在我的 UITableViewController 初始加载时,第一行隐藏在导航后面,但如果我推送到另一个 View 并返回到此 UITableViewController,它会正确加载并且第一行不会被遮挡。我想不通。
这是表格初始加载的屏幕截图,右边是我从通过单击一行推送的 View 之一返回之后的屏幕截图
这是我的 Controller 代码:
class AccountInfoTableViewController: UITableViewController{
var delegate: AccountInfoTableViewDelegate?
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.topViewController.title = "Account Info"
self.automaticallyAdjustsScrollViewInsets = true
println("NAV BAR HEIGHT \(self.navigationController?.navigationBar.frame.size.height)") // 44.0
// prints NAV BAR HEIGHT 44.0
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 70
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if let cell = tableView.cellForRowAtIndexPath(indexPath){
delegate?.accountInfoTableRowClicked(cell.textLabel!.text!)
}
}
可能的重要说明:
这个 UITableViewController 用于标签栏 Controller
添加了更多细节和代码 in this question
最佳答案
看看您的其他问题,我想知道将 UITabBarController 嵌入 UINavigationController 是否是同一个问题。如果是这样的话,再次回顾一下, Controller 层次结构应该如下所示:
第一个 UINavigationController -> 第一个 UITableViewController 第二个 UINavigationController -> 第二个 UITableViewController 最后,将上述两个 UINavigationControllers 添加到 UITabBarController 的 viewControllers 数组中。
希望对您有所帮助!
关于ios - 初始加载时导航 Controller 后面的 UITableViewController 中的 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28994939/