MichiganLabs / AnimatingTableViewHeader

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

Search Bar does not always expand #2

Closed sp71 closed 7 years ago

sp71 commented 7 years ago

Hey! This is a great project you worked on but I found one issue. I changed numberOfRowsInSection to return 5. Now if you try collapse the header, nothing will happen. Thanks again for the awesome blog post 👍

johndelong commented 7 years ago

Hi @sp71! Thanks - glad you've found it helpful!

Looks like this behavior might be related to this issue. Have you tried cloning the project here?

If you followed the blog closely, I can see how you would have stumbled across this issue as I have not updated the blog to reflect this fix. However, I'll be sure to update it today so that others won't have the same problem. :)

Let me know if you are still seeing the issue after cloning the project here on github. Thanks!

sp71 commented 7 years ago

The gitHub repo works great.

Would it be possible to still have the collapse/expand functionality in this scenario as well? If not, I'll go ahead and mark the ticket as resolved.

johndelong commented 7 years ago

ah, I think I misunderstood your original question. The situation you are describing is where there is not enough cells for the ScrollView to scroll (although it may "bounce" if you have that feature turned on). In this scenario, I've forced the header to stay open since we cannot really listen to the changes in contentOffset to determine how to open/close the header reliably.

There may be a way to accomplish what you want to do, but this project is geared towards just having the basic functionality so that others (like yourself) can tweak it to be exactly what they want. :)

Hope that helps! Let me know if you have any other questions!