简体   繁体   English

在Apple的MultipleDetailViews示例中调用numberOfRowsInSection但不调用cellForRowAtIndexPath

[英]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.

相关问题 选择器在numberOfRowsInSection中被调用,但不在cellForRowAtIndexPath中被调用 - Selector gets called in numberOfRowsInSection but not in cellForRowAtIndexPath cellForRowAtIndexPath:被立即调用,而numberOfRowsInSection:不被调用 - cellForRowAtIndexPath: being called immediately while numberOfRowsInSection: is not called iOS:在numberOfRowsInSection之后没有立即调用cellForRowAtIndexPath - iOS: cellForRowAtIndexPath not being called immediately after numberOfRowsInSection 在调用 reloadData 时调用 numberOfRowsInSection 后有时不调用 cellForRowAtIndexPath - cellForRowAtIndexPath is not called sometimes after calling numberOfRowsInSection on calling reloadData 如何在Apple的SampleDetailViews样本的详细视图中推送视图控制器? - How can I push view controllers in detail view of Apple's sample MultipleDetailViews? cellForRowAtIndexPath:未调用 - cellForRowAtIndexPath: not called 我们如何将 numberOfRowsInSection 同步到 cellForRowAtIndexPath? - How do we sync numberOfRowsInSection to cellForRowAtIndexPath? numberOfRowsInSection:未在 reloadData 上调用 - numberOfRowsInSection: not called on reloadData 没有为UITableView调用numberOfRowsInSection - numberOfRowsInSection not being called for UITableView UITableViewController不会调用cellForRowAtIndexPath但是numberOfSectionsInTableView和numberOfRowsInSection确实设置得当 - UITableViewController will not call cellForRowAtIndexPath BUT numberOfSectionsInTableView and numberOfRowsInSection are indeed set properly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM