UICollectionView performBatchUpdates: asserts unexpectedly if view needs layout?

后端 未结 2 1470
野的像风
野的像风 2021-02-09 16:58

If I call -[UICollectionView performBatchUpdates:] from inside viewWillAppear:, inside viewDidAppear:, between these methods, or anytime t

2条回答
  •  滥情空心
    2021-02-09 17:52

    This is expected behaviour and not a bug. From the documentation on performBatchUpdates:

    If the collection view's layout is not up to date before you call this method, a reload may occur. To avoid problems, you should update your data model inside the updates block or ensure the layout is updated before you call performBatchUpdates(_:completion:).

提交回复
热议问题