The iOS app Path has this really cool layered scrollView/tableView combination and I’m trying to figure out how it works . . .
If you havent seen it, there is an image that sits behind a UITableView such that when you scroll the tableview, the background image scrolls as well, but at a different rate.
Not sure how they achieve this effect, but I think it may be by layering two UIScrollViews one on top of the other and messing with the offsets/headers.
Has anyone come across this effect and if so does anyone have any ideas of how it may be achieved?? I’m currently having issues allowing a touch to scroll both scrollViews simultaneously.
Thanks!
Sounds like a simple sort of parallax effect. You’re an the right track (or a right track, there are multiple ways to do this).
the simplest way to achieve what i think you’re asking for would a scroll view behind your table view, which has a content size the same height as the image background. put your image in this scroll view.
Then, implement the scrollviewdidscroll method and detect when your table view scrolls. Use the information to set the scroll offset for the background image scroll view. EG, whatever percentage offset your tableviews scroll is, set the background scroll to the same percentage.
alternatively, if you don’t want to use a second scroll view, you can use the percentage offset to just move a uiimageview up or down in the background.
once again, there are many ways you could implement that background moving, i’ve listed two simple ones, but bear in mind if your image is huge, you will need to break it up into some smallers parts, or use the uiscrollview method and load tiles.
/brain dump.