Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Video Tutorial: Swift Scroll View School Part 8: Content Insets II

In this video tutorial you'll learn more about content insets to better display your content in scroll views.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3911-scroll-view-school/lessons/9

Hello, Greg. Thanks for your good leture.

I have a question in the code for parallax scrolling.

// scroll the background relative to the foreground amount
backgroundScrollView.contentOffset = CGPoint(x: 0, y: scrollPadding + (paddedHeight * scrollPct))

Why did you add scrollPadding on offset y even though it was considered when getting paddedHeight?
The result also works well without additional scrollPadding.

Thanks for your answer in advance.

I don’t know why the solution code for parallax scrolling is so complicated. I still haven’t wrapped my head around it.

I decided to just do this:

func scrollViewDidScroll(_ scrollView: UIScrollView) {
    if scrollView == fgScrollView {
        bgScrollView.contentOffset = CGPoint(x: 0, y: fgScrollView.contentOffset.y / 10)
    }
}

By the way, it makes more sense to scroll the foreground at a faster pace than the background to create that atmospheric perspective feel.

For some reason the video of Lesson 9 doesn’t load. I can watch Lesson 8 and 10 without a problem.

Hi Brian, I am having the same issue as experienced by the above user - @ipaul .
I am unable to load the video for the course - “9 - Nested Scroll Views”. Can you please upload the video ? Thanks!

@premal I sent an email to RW support about the missing video. I suggest you do the same, hopefully we’ll make enough noise for somebody to do something.

Busted for me too, any word on a fix?

there are a lot of videos in this site that are not working … thanks …