Skeletonview: Issue displaying skeleton view on all table view cells

Created on 3 Aug 2018  路  18Comments  路  Source: Juanpe/SkeletonView

鈿狅笍 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

awaiting user input given up 馃 possible bug

Most helpful comment

@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.

All 18 comments

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

Had the same issue happen, only fixed when implementing

tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 150.0

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.

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

^^ 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.

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.

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

Thanks for the responses 馃憦馃徏
So we could close this issue, since it seems resolved, right?

@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.

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.

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

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.

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.

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

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.

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.

Has this been fixed yet?

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raphaklr picture raphaklr  路  5Comments

normand1 picture normand1  路  3Comments

son picture son  路  4Comments

kak2008 picture kak2008  路  4Comments

adelbios picture adelbios  路  4Comments