1

I have a UIScrollView under a navigationbar in a detail viewcontroller.

The viewcontroller settings are the following:

enter image description here

The scrollview is pinned to the Safe Area (trailing, leading, bottom, top = 0).

enter image description here

I want to put the entire scrollview below/under the navigationbar, so that, if I make the navigationbar transparent, I can see the scrollview pinned to the top border of the device (while, at the moment, the scrollview area top corresponds to the bottom border of the navigationbar). The navigationbar should cover part of my scrollview.

I tried adautomaticallyAdjustsScrollViewInsets, contentInsetAdjustmentBehavior, and other similar solutions but nothing seemed to work.

Finally, I noticed if I replace the safe area top constraint with a superview constraint I get the expected result but I’m here to ask: is this the way to go? Is it safe? Are there any possibile drawbacks?

3000
  • 187
  • 1
  • 12
  • 1
    just pin with super view and set content inset in `viewDidLayout` – SPatel Mar 01 '19 at 12:08
  • 1
    If your app looks okay on iPhoneX and higher, then nothing else to worry about. Safe area is there to help us pin views to the recommended margins, nothing else would break if you pin your view to the superview. – pckill Mar 01 '19 at 16:28

0 Answers0