SkeletonView icon indicating copy to clipboard operation
SkeletonView copied to clipboard

Collection View Hide Skeleton Bug - iOS 12.4

Open giantramen opened this issue 4 years ago • 10 comments

What did you do?

collectionView.showAnimatedGradientSkeleton()

Then after loading data collectionView.hideSkeleton()

What did you expect to happen?

Skeleton hides.

What happened instead?

Simulator Screen Shot - iPhone 8 - 2020-03-16 at 08 50 23 The skeleton doesn't go away.

Steps to reproduce the behavior

Create collection view and run on iOS 12.4, show skeleton and then after delay hide the skeleton. This is not an issue on iOS 13.

SkeletonView Environment

SkeletonView version: 1.8.5 Xcode version: Version 11.3.1 (11C504) Swift version: 5

giantramen avatar Mar 16 '20 13:03 giantramen

I 'm facing same issue. Did you find solution to it

mahmoudOmara avatar Apr 09 '20 13:04 mahmoudOmara

I did not find a solution.

giantramen avatar Apr 09 '20 14:04 giantramen

Hello, the same thing happened to me, I hope it works for you. In my case it was because the animation started in viewDidLoad, I put it in viewDidAppear and it was solved, but clarifying that the bug only plays for ios versions less than 13.

Lrosasarce avatar Apr 10 '20 06:04 Lrosasarce

Hello, the same thing happened to me, I hope it works for you. In my case it was because the animation started in viewDidLoad, I put it in viewDidAppear and it was solved, but clarifying that the bug only plays for ios versions less than 13.

I tried it and the skeleton sometimes doesn't hide. I work around the issue by calling hide skeleton in cell for item while configuring the cell.

mahmoudOmara avatar Apr 12 '20 01:04 mahmoudOmara

@giantramen after adding showAnimatedSkeleton to prepareSkeleton closure bug fixed (I tested on iOS 11)

collectionView.prepareSkeleton { _ in
     self.collectionView.showAnimatedSkeleton(usingColor: .gray, animation: nil)
}

Elshad avatar Apr 23 '20 17:04 Elshad

Some issues with tableviews not hiding and not hiding animated seem to be due in part to the changes to the setOpacity method that were introduced here:

https://github.com/Juanpe/SkeletonView/commit/2f2e542d51e4ce213439e051ad913a89d58fd36e#diff-9eb1f0cbab2c306e2cdd6b5ca5d7df0cL142

Either removing the DispatchQueue.main.async {} code that was introduced or putting the entire implementation within a single async block seems to improve the behavior.

wcwynn avatar May 15 '20 19:05 wcwynn

@Juanpe I think there may be a minor issue with the setOpacity method... at least for table views. See (https://github.com/Juanpe/SkeletonView/issues/277#issuecomment-629431593).

Do you recall why that code change was required as part of the bug fix? Specifically, why the things needed to be scheduled as 3 different async tasks instead of 1? Or why they needed to be async at all?

wcwynn avatar May 18 '20 02:05 wcwynn

@Elshad solution did a trick for me. Thx! prepareSkeleton is an extension from UICollectionView, so it's supposed to prepare a collectionView for Skeleton manipulations👌🏻

Kharauzov avatar Sep 02 '20 12:09 Kharauzov

Thanks @wcwynn for the research. Let me check it

Let's you guys when I have more info about that.

Juanpe avatar Sep 07 '20 14:09 Juanpe

I found this issue on iOS 13 earlier. Try call hideSketleton in next runloop worked: DispatchQueue.main.async { self.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.2)) }

quanh avatar Oct 22 '20 01:10 quanh