Houston, I have a problem, which I am working on for 5 days and cant fix it: So, I am working on an app which has tabBarController. On the first tab, there is a tableViewController with some objects in it. And when I press a cell, I turn to form with a button in it. And when I press this button, it saves the title of navigationBar which is on the top (so, it saves a title of cell which you pressed). Then, when I turn to another (second) tab, we can see a view with tableView in it. And what I expecting to see in a cell is that title of navBar(or cell) from the first tab. BUT instead, I see in this tableView ALL the objects from the first tableView, but not that one I saved.
Here is my code: https://gist.github.com/1501328
So again: First tab has a tableViewController. When I press a random cell, I move to another view with button on it. When I press the button I save the title of navBar, so its the same as cell name which I tapped. And when I move to second tab, I can see a view with tableview in it and I want to see a saved title in a cell but I see ALL the Objects from the first tab tableView.
I despair, please, help me stackoverflow community ! ! !
The reason why you got the same content in the two table views is most probably because they share the same
dataSource.If the same object is meant to be the dataSource of two (or more) table views, then you must make the difference in delegate and datasource methods (using the
tableViewparameter).Check if the title information is stored at the right place, and then double check delegate and datasource methods and ensure they make the difference between the table views when returning number of rows and cells.
If not, then set the appropriate
delegateanddataSourcefor the table views that displays wrong values.When looking at the code, only
Favoritesis conforming to delegate and datasource protocols, is this object the delegate and datasource for both tables ? Nothing in these methods take care of the difference…