ios - 初始加载时导航 Controller 后面的 UITableViewController 中的 UITableView

标签 ios uitableview swift uinavigationbar

在我的 UITableViewController 初始加载时,第一行隐藏在导航后面,但如果我推送到另一个 View 并返回到此 UITableViewController,它会正确加载并且第一行不会被遮挡。我想不通。

这是表格初始加载的屏幕截图,右边是我从通过单击一行推送的 View 之一返回之后的屏幕截图

enter image description here

这是我的 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/

相关文章:

ios - 从一个 ViewController 导航到另一个 ios 后如何保持复选框状态

ios - 有关 Xcode iOS 7 Objective C 的一般问题

ios - TabBar 覆盖了 TableViewController 的 TableView(需要 Swift 解决方案)

iOS Parse Block 结果存储在 UILabel 中

ios - 如何在 NSPredicate 中定义临时变量?

ios - 在 Swift 中从 CVPixelBufferRef 获取像素值

ios - 平台的子平台无效

ios - '(@lvalue Int) -> $T 7' is not identical to ' 字典 <Int,Int>'

iphone - 关于button.tag = indexPath.row的帮助

ios - Swift:计时器在前台/后台运行