How can you trigger the viewWillAppear of a UITableView AFTER its UINavigationController?
Posted
by Troy Sartain
on Stack Overflow
See other posts from Stack Overflow
or by Troy Sartain
Published on 2010-04-07T23:27:27Z
Indexed on
2010/04/07
23:33 UTC
Read the original article
Hit count: 295
I have a situation where I use a tab bar set up but with nav bar controllers on a couple tabs. Those tabs have table views on them. Everything works great, I can pick a tab and get a different table in a nav bar structure. The other tabs are non-nav controllers. Fine.
I want to use the same table view controller and even the same detail screen since they are essentially the same format. I have two-dimensional arrays and a couple of vars tracking which tab and which table row so when I get to the detail it's all good.
Now to the problem. It all seems to work just fine until I return to a tab that has already been visited. At that point, I do indeed get a viewWillAppear for both the view controller of that specific tab and the table view controller. However, I get the table view one first! It doesn't know which tab was tapped on; the other one does but that's too late to dynamically change the table!
Any suggestions? Am I being too greedy about code duplication? I mean I could just make separate controllers for for each table view and then separate detail view controllers but I thought I had a good solution.
© Stack Overflow or respective owner