在 performBatchUpdates 中重新加载 collectionview 时未调用 UICollectionview cellForItemAtIndexPath
UICollectionview cellForItemAtIndexPath not getting called when collectionview reload in performBatchUpdates
我必须为 UICollectionview reloadData 设置动画,所以我在 UICollectionView performBatchUpdates 中调用了 reloadData。
这个动画效果很好,但不幸的是,UICollectionviewcell 子视图(我的自定义视图)在调试时没有更新,注意到 cellForItemAtIndexPath 没有被调用,为什么?
[UICollectionview performBatchUpdates:^{
[UICollectionview reloadData];
} completion:nil];
提前致谢
你能告诉我们更多关于如何设置子视图的代码吗?
我想这可能对您有所帮助:尝试在 layoutSubviews
、
中设置您的子视图
我必须为 UICollectionview reloadData 设置动画,所以我在 UICollectionView performBatchUpdates 中调用了 reloadData。
这个动画效果很好,但不幸的是,UICollectionviewcell 子视图(我的自定义视图)在调试时没有更新,注意到 cellForItemAtIndexPath 没有被调用,为什么?
[UICollectionview performBatchUpdates:^{
[UICollectionview reloadData];
} completion:nil];
提前致谢
你能告诉我们更多关于如何设置子视图的代码吗?
我想这可能对您有所帮助:尝试在 layoutSubviews
、