MichiganLabs / AnimatingTableViewHeader

A Swift project explaining how to animate a header above a UITableView
164 stars 35 forks source link

Laggy header when scrolling tableview with image cell #5

Closed vnthanh closed 6 years ago

vnthanh commented 6 years ago

I'm having an issue when my table view cell rendering image for the first time, the header seems to be stretched suddenly right just before the table view was about to display that image cell. It's happened to be tableview's contentOffset get changed somehow in this case when rendering image.I'm having self-sizing table view cell implemented by the way. Any ideas what's going on? Thanks a lot for your elegant tutorial.

johndelong commented 6 years ago

@vnthanh its hard to say for sure without looking at the code. Could you provide a snippet of your custom UITableViewCell and possibly any changes you've made to ViewController.swift?

vnthanh commented 6 years ago

After many hours of researching, it's the "self-sizing table view cell" which causes the problem. Setting the appropriate value on "estimatedRowHeight" solved the strange lagging on table view and my header banner. Did you consider this table view with self-sizing cell case? Thanks for your response.

johndelong commented 6 years ago

Great! Glad to hear that you were able to figure that out. Automatically sizing UITableViewCells can be tricky sometimes, that is for sure.

This project wasn't necessarily intended to cover all cases for the different types of content you might want to display below your header. The idea was to make something very simple and minimal so that others (like yourself) could read the project and get the general concept of what is going on without having to wade through lots of unnecessary code that distracts from the main goal.

With that said, I'm always happy to lend a hand if somebody has an idea they would like to try out with this expanding/collapsing header implementation. :) Best of luck and keep developing!

johndelong commented 6 years ago

@vnthanh By the way, if you think your solution/implementation might be useful to others, feel free to make a PR and I'd be happy to reference it as an example.