Scroll View School - Part 16: Section 2: Content | Ray Wenderlich

Content insets are where you can add padding to a scroll view. This video will show you how.


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

For the “Adjust Scroll View Insets” checked or uncheck, the effect seems not obvious.

@vegetarianzombie Can you please help with this when you get a chance? Thank you - much appreciated! :]

I was wondering how the content offset of the scrollView automatically adjusted to (0, -44) after you added fgScrollView.contentInset = UIEdgeInsets(top: navigationBar.frame.height, left: 0, bottom: 0, right: 0) in viewDidLoad when you were manually adding a navigation bar.

@vegetarianzombie xcode doesn’t recognize this “fgScrollView.contentInset = UIEdgeInsets(top: navigationBar.frame, left: <#T##CGFloat#>, bottom: <#T##CGFloat#>, right: <#T##CGFloat#>)”

The frame part is where it is not pulling up.

is @vegetarianzombie MIA? he hasn’t talked to @luckylisa since feb 13

@lac_ekim The video team has been hard at work over the past few weeks on the Android and Kotlin launch on the website. They will be back on the forums soon. Thank you for your patience - much appreciated! :]

1 Like

hello. For Some reason after adding the navigation controller and unchecking adjusts scroll view insets (for both the initial navigation controller and the view controller.) and checking both (under top bar , under bottom bar) for both navigation controller and the view controller, the content always seems to start from a few points after the end of navigation bar. Opposed to the video in which adding the navigation view controller shows content start from the top of the screen (and below(as if inside) the navigation bar when the options: adjusts scroll view insets, under top bar, under bottom bar are unchecked. Attached image for reference.

!

@luckylisa It seems as if in the size inspector, if you set content inset to Never, the behavior is similar to the one shown in video. After toggling the Adjusts Scroll View Insets, you will see the same behavior as in the video. Took me sometime to figure out.

@vegetarianzombie Is the solution to the problem to set ‘Content Inset’ on scroll view in the attribute inspector to ‘Never’? Thanks.

@srinath2763 @lac_ekim @frankl @luckylisa Please check out the updated version of the course when you get a chance:

I hope it helps!