Skeletonview: UITableView is not working for First Time.

Created on 28 Jun 2019  路  8Comments  路  Source: Juanpe/SkeletonView

What did you do?

-> Turned on skeleton view to all view hierarchy in storyboard.
In ViewDidLoad tried to hit API Async and before hitting the API added tableView.showAnimatedSkeleton()
and After receiving Response tableview.hideSkeleton(). The whole API Calling has been accommodated in a function

-> Now when I try to refresh the UITableView using UIRefreshControl it is working fine.

What did you expect to happen?

Should get skeleton loading when trying to hit the API Request.

What happened instead?

Undefined behaviour.

  1. Showing No skeleton loading just blank screen.
  2. Sometimes showing large gray coloured screen.

Steps to reproduce the behavior

  1. Take a view controller, Add UITableView, Add UITableViewCell, Add View inside Content View, and add sub UI Elements like Image, Label etc.
  2. In ViewDidLoad tried to hit API - Before calling the API - Called tableView.showAnimatedSkeleton() and after response - tableview.hideSkeleton()

Please note below points.

  1. View added inside content view has constraints given to Content View. Not to the UITableViewCell. (Tried giving it to UITableViewCell, but no chance.)
  2. UITableViewCell - Contains Accessory as Disclosure Indicator.

SkeletonView Environment

SkeletonView version:
Version - 1.5.0
Xcode version:
Xcode - 10.2.1

Swift version:
Swift-4.2

PS:

  1. Tried debugging the SkeletonView - It give no log for the first time. When I refresh the UITableView with UIRefreshControl it is working Good. Below is the screen shot.

Simulator Screen Shot - iPhone 6 - 2019-06-28 at 18 35 04

awaiting user input 鉂攓uestion

Most helpful comment

Sk盲rmavbild 2019-07-29 kl  10 13 58

Make sure the whole table view hierarchy is isSkeletonable for this to work, otherwise it will use the tableview as a big skeleton.

All 8 comments

Any update on this? What can be done?

Hi @srujan-smsc, are you sure that you are calling showSkeleton on main queue? it seems something related to.

Please, let me know it.
Thanks

Hello @Juanpe,

Thanks for your response. I have loaded In Main Thread only.
And, I have observed the problem that I have been sending the height as 0 instead of a valid height in heightForRowAt indexPath.
Now, after giving a fixed height I observe a blank skeleton loading through out the UITableView.
Again My Implementation is stated below.

  1. ViewDidload-
    Called API which has Skeleton loading in Main Thread.
  2. Will Hide Skeleton Loading when I get response.
  3. Implemented SkeletonTableViewDataSource Method - collectionSkeletonView(_ skeletonView: UITableView, cellIdentifierForRowAt indexPath ONLY
  4. Mainly - Enabled Skeleton Loading For UITableVIew and all Sub Elements

Please refer below screenshot.
Simulator Screen Shot - iPhone X - 2019-07-08 at 13 03 29

Let me know what can be done?
Thanks :)

Enabled Skeleton Loading For UITableVIew and all Sub Elements

also the cell's isSkeletonable enabled?

Sk盲rmavbild 2019-07-29 kl  10 13 58

Make sure the whole table view hierarchy is isSkeletonable for this to work, otherwise it will use the tableview as a big skeleton.

The same problem

Did you set UITableView rowHeight or estimateRowHeight?
In my case, I forgot to set those properties of tableView in storyboard builder

Yes, isSkeletonable is enabled, and ran the code in main thread.
Working good.
Thanks a lot for your support, and sorry for the delay.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Manikandan271192 picture Manikandan271192  路  4Comments

jamesTheKid picture jamesTheKid  路  4Comments

pauloec picture pauloec  路  7Comments

mohpor picture mohpor  路  6Comments

ghost picture ghost  路  7Comments