I'm stuck. I have a slightly complicated hierarchy of views. One UITabBarController to rule three UINavigationControllers. In each NavigationController I has a root UITableViewController that spaws others of its kind. All are subclassed. Everything was working yesterday, and after adjusting some scrollview insets and switching to blocks, I have a problem.
When I push another TableViewController onto the navigation stack everything is ok. But, when I pop that TableViewController and log the contentSize of the root TableViewController
viewWillAppear contentSize: {320, 15063.414}
viewWillLayoutSubviews contentSize: {0, 0}
viewDidLayoutSubviews contentSize: {0, 0}
viewDidAppear contentSize: {0, 0}
This only happens when popping from my custom TableViewController to another TableViewController of the same kind. Any idea what's going on (presumably in viewDidLayoutSubviews
)?
I am suspecting something might be up with the TabBarController or NavigationController but I'm still drawing a blank.
I've updated what was logged to include viewWillLayoutSubviews
and viewDidLayoutSubviews
. It appears everything is zeroed out before AutoLayout even gets its hands on it. Is that assumption correct?
Edit
The same patter of setting content size properly and then setting it to zero also happens when I push a view controller on top. Then when I pop it off, it sets the proper contentSize and then removes it.
I've come up with a workaround. I cache my cell heights so in viewWillLayoutSubviews
I set the contentSize properly. The problem still persists if I present a view modally because viewWillLayoutSubviews
isn't called. Something is weird still.