indexpath.row从1开始而不是0 [英] indexpath.row is starting from 1 instead of 0

查看:196
本文介绍了indexpath.row从1开始而不是0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临一个与uitableview相关的问题。当我的表的数据源/ numberofrowsinsection有3个值时,
,cellforowatindexpath从0-1而不是0-0开始。
有人可以帮助我找出发生此问题的可能原因。
甚至尝试打印日志,但日志显示为0 -1和0 -2但不是0 -0。
这意味着它没有被调用第一行,即0 -0。

i am facing a strance issue with a uitableview. sometime when my table's datasource/numberofrowsinsection has 3 values, cellforowatindexpath starts from 0-1 instead of 0-0. can someone help me out finding the possible reasons for this issue to happen. even tried printing the logs but the logs were shown for 0 -1 and 0 -2 but not for 0 -0. That means it is not getting called for the first row i.e 0 -0.

推荐答案

tableView:cellForRowAtIndexPath:根据需要调用以显示单元格,如果不显示单元格则不调用它。如果没有显示第0行,则不会调用section-cell 0-0。

tableView:cellForRowAtIndexPath: is called as needed to display a cell, if a cell is not going to be displayed it is not called. If row 0 is not being displayed section-cell 0-0 will not be called.

这篇关于indexpath.row从1开始而不是0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆