views:

41

answers:

2

Hi,

If you download this sample (ipad): http://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html and you set a breakpoint at numberOfRowsInSection and also at cellForRowAtIndexPath and you start in landscape then i have the following question:

First: the app comes twice in numberOfRowsInSection -> "why 2 times? Because there are 2 sections.. oké, but where did they define that there are 2 sections?"

Second: the app comes twice in numberOfRowsInSection and then calls cellForRowAtIndexPath -> no questions here... this is normal

Third: when i change to portrait mode and press the popoverbutton the app calls numberOfRowsInSection 3 times and never called cellForRowAtIndexPath -> "why 3 times? Why dont he call cellForRowAtIndexPath"?

Thanks in advance!

+1  A: 

From glancing at the code, it looks like there is only one section in the root view controller, and that section has two rows (the comment in tableView:numberofRowsInSection: is wrong).

It's anybody's guess as to why tableView:numberOfRowsInSection: is called multiple times, and tableView:cellForRowAtIndexPath: is not called. It's up to the internal implementation of the tableview to determine when it needs to call those methods to lay out its content. And if you implement those methods correctly, it doesn't matter how many times they're called.

Brian
Yes it does matters, because i have based my app on this sample and now i have some conflicts with that. Sometimes my cellForRowAtIndexPath is not called so that ruins my app. It's very strange it calls cellForRowAtIndexPath in landscape but not in protrait mode... so when i saw the problem is also with the sample i knew there is smth wrong.
meersmans