初始加载时导航控制器后面的UITableViewController中的UITableView [英] UITableView in UITableViewController behind navigation controller on initial load

查看:71
本文介绍了初始加载时导航控制器后面的UITableViewController中的UITableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的UITableViewController的初始加载中,第一行被隐藏在导航后面,但是如果我推送到另一个视图并返回到这个UITableViewController,它将被正确加载并且第一行不会被遮挡。我无法弄明白这一点。

On the initial load of my UITableViewController the first row gets hidden behind the navigation, but if I push to another view and return to this UITableViewController it is loaded correctly and the first row isn't obscured. I can not figure this one out.

这是表的初始加载的屏幕截图,右边的那个是我从其中一个视图返回之后是通过点击一行推的

Here's a screen shot of the initial load of the table and the one on the right is after I return from one of the views that was pushed by clicking a row

这是我的控制器代码:

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用于标签栏控制器

This UITableViewController is used in a tab bar controller

添加了更多细节和代码在这个问题中

Added some more detail and code in this question

推荐答案

看着你的另外一个问题,我想知道在UINavigationController中嵌入UITabBarController是否也是同样的问题。如果是这种情况,Just再次回顾,控制器层次结构应如下所示:

looking at your other question, I'm wondering if it's the same issue with having the UITabBarController embedded within a UINavigationController. If that's the case, the Just to recap again, the controller hierarchy should be as follows:

第一个UINavigationController - >第一个UITableViewController
第二个UINavigationController - >第二个UITableViewController
最后,上面的两个UINavigationControllers都添加到了UITabBarController的viewControllers数组中。

First UINavigationController -> First UITableViewController Second UINavigationController -> Second UITableViewController Finally, both of the above UINavigationControllers added to the UITabBarController's viewControllers array.

希望有所帮助!

这篇关于初始加载时导航控制器后面的UITableViewController中的UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆