![](/img/trans.png)
[英]Selector gets called in numberOfRowsInSection but not in cellForRowAtIndexPath
[英]numberOfRowsInSection called but not cellForRowAtIndexPath in MultipleDetailViews sample of apple
如果您下载此示例(ipad): http : //developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html并在numberOfRowsInSection和cellForRowAtIndexPath设置断点,然后从横向开始我有以下问题:
第一 :应用程序在numberOfRowsInSection中出现两次 - > “为什么2次?因为有2个部分......好吧,但是他们在哪里定义了2个部分?”
第二 :应用程序在numberOfRowsInSection中出现两次,然后调用cellForRowAtIndexPath - > 这里没有问题......这是正常的
第三 :当我改为纵向模式并按下popover按钮时,应用程序调用numberOfRowsInSection 3次并且从未调用过cellForRowAtIndexPath - > “为什么3次?为什么不调用cellForRowAtIndexPath”?
提前致谢!
从浏览代码看,根视图控制器中只有一个部分,并且该部分有两行( tableView:numberofRowsInSection:
的注释tableView:numberofRowsInSection:
错误)。
任何人都猜测为什么tableView:numberOfRowsInSection:
被多次调用,并且没有调用tableView:cellForRowAtIndexPath:
由tableview的内部实现决定何时需要调用这些方法来布局其内容。 如果你正确地实现这些方法,那么调用它们的次数并不重要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.