Reputation: 1190
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
Here's my controller code:
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!)
}
}
}
POSSIBLE IMPORTANT NOTE:
This UITableViewController is used in a tab bar controller
Added some more detail and code in this question
Upvotes: 1
Views: 1098
Reputation: 116
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:
First UINavigationController -> First UITableViewController Second UINavigationController -> Second UITableViewController Finally, both of the above UINavigationControllers added to the UITabBarController's viewControllers array.
Hope that helps!
Upvotes: 1
Reputation: 2192
Is the UITableViewController embedded in a UINavigationController in the storyboard? Do this, and you should be golden. Have you tried manually adjusting the top content offset (via the storyboard) to 44?
Upvotes: 0