UINavigationController backBarButtonItem click vs popViewController
I have a ViewController with a tableView in it. When I click some row, I push the view controller and show a new view controller which has a back button in the navigationController and another button(TestButton) in the new view Controllers view.
When I click back button in UINavigationController the "numberOfRowsInSection" of the view controller is called and then the "cellForRowAtIndexPath" is called for each row in the table view.
But when I click "TestButton" which does a
[self.navigationController popViewControllerAnimated:YES] the parent view controllers "numberOfRowsInSection" is not called but directly "cellForRowAtIndexPath" is called. I am so confused. Can anybody guide me in the right direction as to what the differnence between the two is?
numberOfRowsInSection is how the table knows how many rows it needs to draw,
cellForRowAtIndexPath is how the table knows which UITableViewCell to draw for each row.
Maybe numberOfRowsInSection is not called because the table knows that nothing has changed. For example, whenever you call [tableView reloadData];, I assume that all of those methods get re-called in order to redisplay all the data, because some changes may have been made.
numberOfRowsInSection is how the table knows how many rows it needs to draw,
cellForRowAtIndexPath is how the table knows which UITableViewCell to draw for each row.
Maybe numberOfRowsInSection is not called because the table knows that nothing has changed. For example, whenever you call [tableView reloadData];, I assume that all of those methods get re-called in order to redisplay all the data, because some changes may have been made.
I have a another question related to this. If I keep swithing back and forth between two view controllers ( push view controller -> pop view controller -> push view contoller -> pop view controller ..) I see that the net bytes used keep increasing. It never comes down. There are no memory leaks but the net bytes used never comes down ( by the way I am talking about the instrument -> leaks) What could be the reason?
Adding to previous post.... I have downloaded "The Elements" example from apples iphone example applications. I notice the same behaviour. The net bytes keep increasing. This is really a big problem for me because on the first view which has a table view. Upon clicking a row it would display an image specific to that row(push view controller) and the image is pretty big. So now when I go back and click another image the net bytes keep increasing and ultimately app crashes. I am clueless here. I have trying to resolve this since long time and would appreciate anybody help me out.