chr0x
chr0x

Reputation: 1251

How create a tableView that covers an image when it is scrolled

I'm trying to develop something like CSStickyHeaderFlowLayout but customized for my table, but I'm not sure how can I achieve this goal. The idea is

enter image description here

Someone can give me a hint how achieve this objective?

Upvotes: 0

Views: 37

Answers (3)

GetSwifty
GetSwifty

Reputation: 7756

While using a tableview within a scrollview would likely work, your tableview would have to always be it's full size (without some annoying constant re-sizing), so you'll lose the value of the enqueuing/dequeueing that makes tableViews work so well.

The CSStickyHeaderFlowLayout has example pretty similar to what you want to do, did you look at their examples? You may be able to play with it and get it to do what you want If your problem is simply having a constant title, you can just add a view above the table or use the NavBar and adjust the contentInsets

You might also consider using a collectionView instead. It's much more flexible as far as layout goes.

Upvotes: 0

Elias Marcopoulos
Elias Marcopoulos

Reputation: 29

To add to Vollan's answer, to make the title stay still you could use a view that contains two subviews: the first is the scrollview (with the image and table as Vollan suggests) and then add another view (like a UILabel) for the title. Thus, while the image and table scroll in the scrollview, the title will stay still.

Upvotes: 1

Vollan
Vollan

Reputation: 1915

Best solution would be to wrap everything inside an UIScrollView. That will allow you to scroll to bottom of the screen and then only scroll the tableview. That way it will appear like the tableview will overlay the image.

Upvotes: 0

Related Questions