How to create a stretchable TableViewHeader in iOS ??
You might have seen a collapsable or stretchable tableview header in android. If you check the whatsapp profile/ group settings page , you can see this. If you are using Netflix app, you might have seen a zoom in effect in the tableview header as well. Well, if you ever wondered how to do this in iOS, I will give a simple solution.
Published in
3 min readSep 14, 2017
Note: I have mentioned TableViewHeader
above. But I am not actually using TableViewHeader
for this article.
For understanding what I am doing here, you should be familiar with UIScrollView
and its delegate methods. You also need to know about UIScrollView contentInset property.
So, What’s the UIScrollView contentInset property ?
Refer apple docs for more info: Link
It sets the distance of the inset between the content view and the enclosing scroll view.
Usage: To see a place where this is actually used, look at the build-in Photos app on the iphone. The Navigation bar and status bar are transparent, and the contents of the scroll view are visible…