Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-16-2009, 01:23 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 13
Default 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?

Thanks,
Maneesh
maneeshr is offline   Reply With Quote
Old 04-16-2009, 01:29 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 36
Default

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.
Micksabox is offline   Reply With Quote
Old 04-16-2009, 04:43 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 13
Default Another Question

Quote:
Originally Posted by Micksabox View Post
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?
maneeshr is offline   Reply With Quote
Old 04-16-2009, 04:52 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 13
Default

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.
maneeshr is offline   Reply With Quote
Reply

Bookmarks

Tags
uinavigationcontroller, uitableview, uitableviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 254
19 members and 235 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, Dani77, DarkAn, Desert Diva, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, ryantcb, Speed, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:46 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0