Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection View not showing skeleton for cells #71

Closed
samsidd opened this issue Jun 25, 2018 · 16 comments
Closed

Collection View not showing skeleton for cells #71

samsidd opened this issue Jun 25, 2018 · 16 comments
Labels

Comments

@samsidd
Copy link

samsidd commented Jun 25, 2018

⚠️ Please fill out this template when filing an issue.

🙏🏼 Please check if it already exists other issue related with yours.

What did you do?

I am trying to show skeleton in collection view , i added an image view and a label to a cell set them both skeletonable and also set the cell to skeletonable and in viewDidLoad called showAnimatedGradientSkeleton() on collectionView.

What did you expect to happen?

I thought it should show the collectionView cells as skeleton.

What happened instead?

but it shows the whole collection view as skeleton and the cells dont appear, basically i just have a gray view with a gradient animation showing up.

Steps to reproduce the behavior

Add a collection view , add a cell to it , add imageview and label to cell set isSkeletonable to true
for all of them. Implement the protocol and then run

SkeletonView Environment

SkeletonView version: 1.2.1
Xcode version: 9.3.1
Swift version: 4.0
simulator screen shot - iphone 7 - 2018-06-25 at 18 17 53

@samsidd
Copy link
Author

samsidd commented Jun 25, 2018

Please help me with this, it works on the UItableView if i set the EstimatedRowHeight but since UICollectionView does not have any such property i couldn't resolve it. I also tried the sizeForItem method but it doesnt work also.

@samsidd
Copy link
Author

samsidd commented Jun 25, 2018

wow ! i just wasted a couple of hours for this and a dispatch of 0.1 sec resolved the issue.

@TaomingHuang
Copy link

@samsidd Hey I seem to have the same issue as you used to have. I wonder what does it mean by a dispatch of 0.1 sec?

@bystritskiy
Copy link

I have the same problem

@Sorix
Copy link

Sorix commented Jul 16, 2018

+1

@dmitrycrys
Copy link

dmitrycrys commented Jul 24, 2018

The solution for me was to add in file SkeletonView.swift:
DispatchQueue.main.async after addDummyDataSourceIfNeeded() to fileprivate func recursiveShowSkeleton(withType type: SkeletonType, usingColors colors: [UIColor], animated: Bool, animation: SkeletonLayerAnimation?)
But I still have an issue with blinking content before skeleton appears

@Juanpe
Copy link
Owner

Juanpe commented Aug 2, 2018

Hi, this issue should be solved in latest version (1.3).
You need to prepareSkeleton, you can check this PR (#42)

@romainbiard
Copy link

still not fixed using 1.4

@alkanyunus
Copy link

still not fixed

@alkanyunus
Copy link

alkanyunus commented Oct 16, 2018

You can achieve with

collectionView.prepareSkeleton { [weak self] (done) in
                if let visibleCells = self?.collectionView.visibleCells {
                    for cell in visibleCells {
                           cell.contentView.showAnimatedSkeleton()
                    }
                }
            }

@jonathansolorzn
Copy link

Still not fixed

@lalkrishna
Copy link

lalkrishna commented May 2, 2019

@Juanpe please fix this ASAP. Temporarly I use saxahan's code to make it working. @saxahan thanks :)
SkeletonView v1.5

@stale stale bot added the wontfix label Aug 27, 2019
Repository owner deleted a comment from stale bot Aug 27, 2019
@stale stale bot removed the given up label Aug 27, 2019
@sergeymild
Copy link

still doesn't work

@stale
Copy link

stale bot commented Dec 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the given up label Dec 4, 2019
@stale stale bot closed this as completed Dec 11, 2019
@onderozcan
Copy link

Doesn't work in tableviewcell too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests