![](/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.