Reputation: 1836
So i have a tab bar controller and when I select into the second tab it brings me to a table view controller. I have it setup so that when the viewWillAppear it animates the cells in. The problem I am having is that the first time I go into that view, everything is stationary, but if i go to another tab and come back, everything animates perfectly.
How can I get it to animate in the first time I go to the tab as well?
I have not included code because I do not think it will help answer the question.
Edit* I can go to the tab as many times as I want and it will animate each time, but will never animate on the first load of the app.
Upvotes: 3
Views: 1346
Reputation: 964
I had a very similar issue with viewDidAppear. My problem was that I called the viewDidAppear
function in the TabBarController
to do some stuff but forgot to call super.viewDidAppear(true) in this Method. Because of that the viewDidAppear of the child wasn't called. After I added it everything works like a charm.
So be sure to add super.viewDidAppear(true)
or in your case super.viewWillAppear(true)
in the TabBarController. Maybe it helps
Upvotes: 6
Reputation: 320
I had the same issue. Tried the below in "ViewDidAppear" and it is working.
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.tableView.reloadData()
})
Upvotes: 1