Reputation: 2495
I'm loading my table from nib file, and in viewDidLoad
I can't do anything with the table. I can use table's delegate methods to set the contentOffset, and they work, but it doesn't work in viewDidLoad
.
So is the table even loaded in viewDidLoad
? Probably not. Any idea how to fix it, or check if the table has loaded? (without subclassing)
Thanks!
Upvotes: 0
Views: 2622
Reputation: 160
I have had the same issue but the solution above didn't work for me. It's possible because I am using auto layout or because it's been years since this question was answered.
What worked for me was using viewDidLayoutSubviews. Only then the setOffset worked.
Upvotes: 3
Reputation: 313
The table view is loaded in viewDidLoad, but normally there is no data in it yet. Calling reloadData in viewDidLoad will cause the data to be loaded and the rows to be populated.
Once there is data in the table, and the contentSize of the table is larger than the bounds.size, the tableview will respond appropriately to setContentOffset.
Upvotes: 4