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

Issue displaying skeleton view on all table view cells #85

Closed
JordanPJamieson opened this issue Aug 3, 2018 · 18 comments
Closed

Issue displaying skeleton view on all table view cells #85

JordanPJamieson opened this issue Aug 3, 2018 · 18 comments

Comments

@JordanPJamieson
Copy link

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

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

What did you do?

Added skeleton view to my table view, implemented all of the required methods, and set the estimatedRowHeight as suggested by others.

What did you expect to happen?

I pass in a number for the numberOfRowsInSection method and it will display the skeleton view on that specified number of rows.

What happened instead?

Only the first three table view cells get covered by the skeleton view and the rest of the cells are just blank templates of the table view cell I created in the storyboard. Maybe the height of my table needs to be changed because it's using the estimated number of rows instead?

Steps to reproduce the behaviour

Create a table view and assign the number of rows in section and not every cell gets covered with a skeleton view.

SkeletonView Environment

SkeletonView version:
Latest
Xcode version:
9.4
Swift version:
4

@Juanpe
Copy link
Owner

Juanpe commented Aug 5, 2018

Hi @JordanPJamieson. Could you give more info about your code?
When and where are you calling the showSkeleton method?

@sungkim23
Copy link

sungkim23 commented Aug 14, 2018

Had the same issue happen, only fixed when implementing

tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 150.0

@JordanPJamieson
Copy link
Author

Sorry for the late response, I fixed this issue by setting a default value instead of a dynamic value for the function:

collectionSkeletonView(_ skeletonView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}

My API request wasn't retrieving the data in time to tell this method how many rows to display the skeleton view on before the function executed.

Thanks for the suggestions.

@BryanRyczek
Copy link

BryanRyczek commented Oct 11, 2018

I'm having the same issues where the last cells aren't covered by skeleton view. I've set these params:

tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 100.0

I also implemented this delegate function, which is being called.

collectionSkeletonView(_ skeletonView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}

I'm having the issues on these devices:

-Iphone XS Max
-Iphone XR

Other devices look fine.

Here is an image of what the issue looks like on screen:

https://imgur.com/a/w66fdD8

@BryanRyczek
Copy link

BryanRyczek commented Oct 11, 2018

^^ Just wanted to add that I changed my size class in Storyboard from iPhone XS to iPhone Max and skeleton view renders properly on all devices.

It seems as if the height of my table view was being calculated off the values from storyboard? Dunno.

@r00li
Copy link

r00li commented Dec 7, 2018

I can confirm what @BryanRyczek said here. The last cell was showing without skeleton on iPhones XR and XS Max until I changed the size class in the storyboard.

@NerdBird
Copy link

NerdBird commented Apr 3, 2019

I am seeing the same issue. Thanks @BryanRyczek for a solution! This has been driving me nuts.

@Juanpe
Copy link
Owner

Juanpe commented Apr 4, 2019

Thanks for the responses 👏🏼
So we could close this issue, since it seems resolved, right?

@r00li
Copy link

r00li commented Apr 4, 2019

@Juanpe I wouldn't exactly call this resolved. It is a workaround, but it doesn't solve the issue. The size shouldn't depend on the storyboard values in the first place. If Apple makes a phone with an even taller screen all of the apps will break until somebody updates all of the storyboards again.

@BryanRyczek
Copy link

BryanRyczek commented Apr 4, 2019

I agree with @r00li. The number of skeletoned cells should be calculated by tableview height at runtime, which doesn't seem to be the case.

Also I want to add that if your app is meant for iPad as well as iPhone, you will see this issue on iPad if your size class is set for iPhone.

Unfortunately this issue led me to uninstall this pod and go with a blank background with a spinner.

@BhavikThummar
Copy link

BhavikThummar commented Apr 8, 2019

Hello @Juanpe
I had the same issue, please let me know when you get resolved it. Because size class is not a permanent solution.

@PatrickAdams
Copy link

I thought the numberOfRowsInSection method of SkeletonTableViewDataSource would solve this, but that's not the case either. It's ignoring anything over the calculated amount of rows. If it's calculating 5 rows and I set the number to 6 via that method, it ignores it and uses 5 rows. If I set it to 5 rows it at least hides the last un-skeletoned row. So that's another workaround.

@whoyawn
Copy link

whoyawn commented Jun 4, 2019

Running into a similar error here. I'm using an iPhone XR simulator and a iPhone XR device. When I set my storyboard to the Xs Max, the skeleton view covers 100% of the original view. When I use the iPhone 8 size class, it only covers 80% of the view at runtime.

@bentahyar
Copy link

bentahyar commented Jun 27, 2019

anyone had a fix on this yet?
I experince this on iPhone plus when using collectionview. Setting the size class didn't help at all.
Im using content inset for my collectionview, when I remove the content inset, the skeleton rendered perfectly

@Juanpe
Copy link
Owner

Juanpe commented Aug 23, 2019

Actually, if you don't specify the number of rows, SkeletonView calculates how many rows should be shown based on table view height.

The problem is if you are showing the skeletons when the view will appear, the views are not ready yet, so the skeleton doesn't work correctly. But if you show the skeleton when the view did appear, the problem should be solved.

Another possible solution is calling the method view.layoutSkeletonIfNeeded. This method redraws the skeleton taking account of the new frames.

@stale
Copy link

stale bot commented Oct 22, 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 Oct 22, 2019
@whoyawn
Copy link

whoyawn commented Oct 22, 2019

Has this been fixed yet?

@stale stale bot removed the given up label Oct 22, 2019
@stale
Copy link

stale bot commented Dec 21, 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 21, 2019
@stale stale bot closed this as completed Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants