DZNEmptyDataSet icon indicating copy to clipboard operation
DZNEmptyDataSet copied to clipboard

The view will not update correctly

Open kaiyuanheshang opened this issue 7 years ago • 4 comments

When UITableView or UICollectionView refresh UI via insertItems(at:) or deleteItems(at:), the empty view will not show or hide currectly.

It is because only reloadData() method swizzled.

kaiyuanheshang avatar Aug 15 '18 11:08 kaiyuanheshang

Seems like someone didn't read the code source properly ;) https://github.com/dzenbot/DZNEmptyDataSet/blob/b5b9216d09f19455aa616d3bda32e1c38d3178bd/Source/UIScrollView%2BEmptyDataSet.m#L406 Maybe you forgot to wrap your calls in begin/end updates?

dzenbot avatar Aug 17 '18 18:08 dzenbot

Sorry about that, it is my omission. What i use is UICollectionView for a favorites list.

I use Realm as db, and update UICollectionView with func performBatchUpdates(_ updates: (() -> Void)?, completion: ((Bool) -> Void)? = nil) after the content changed

kaiyuanheshang avatar Aug 18 '18 14:08 kaiyuanheshang

Begin/end updates is deprecated. Any plans to support performBatchUpdates?

ronJobox avatar Aug 30 '18 21:08 ronJobox

I will try to fix it. Any suggestion?

kaiyuanheshang avatar Aug 31 '18 09:08 kaiyuanheshang