How can I check if an indexPath is valid, thus avo

2019-04-17 20:58发布

How can I check to see whether an indexPath is valid or not?

I want to scroll to an index path, but I sometimes get an error if my collection view's subviews aren't finished loading.

7条回答
男人必须洒脱
2楼-- · 2019-04-17 22:04

Perhaps this is what you're looking for?

- (UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath

Return Value: The cell object at the corresponding index path or nil if the cell is not visible or indexPath is out of range.

查看更多
登录 后发表回答