[英]numberOfRowsInSection called but not cellForRowAtIndexPath in MultipleDetailViews sample of apple
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: 如果您下载此示例(ipad): http : //developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html并在numberOfRowsInSection和cellForRowAtIndexPath设置断点,然后从横向开始我有以下问题:
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?" 第一 :应用程序在numberOfRowsInSection中出现两次 - > “为什么2次?因为有2个部分......好吧,但是他们在哪里定义了2个部分?”
Second : the app comes twice in numberOfRowsInSection and then calls cellForRowAtIndexPath -> no questions here... this is normal 第二 :应用程序在numberOfRowsInSection中出现两次,然后调用cellForRowAtIndexPath - > 这里没有问题......这是正常的
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"? 第三 :当我改为纵向模式并按下popover按钮时,应用程序调用numberOfRowsInSection 3次并且从未调用过cellForRowAtIndexPath - > “为什么3次?为什么不调用cellForRowAtIndexPath”?
Thanks in advance! 提前致谢!
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). 从浏览代码看,根视图控制器中只有一个部分,并且该部分有两行(
tableView:numberofRowsInSection:
的注释tableView:numberofRowsInSection:
错误)。
It's anybody's guess as to why tableView:numberOfRowsInSection:
is called multiple times, and tableView:cellForRowAtIndexPath:
is not called. 任何人都猜测为什么
tableView:numberOfRowsInSection:
被多次调用,并且没有调用tableView:cellForRowAtIndexPath:
It's up to the internal implementation of the tableview to determine when it needs to call those methods to lay out its content. 由tableview的内部实现决定何时需要调用这些方法来布局其内容。 And if you implement those methods correctly, it doesn't matter how many times they're called.
如果你正确地实现这些方法,那么调用它们的次数并不重要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.