4

I have a horizontal paging UIScrollview, following is my VFL constraints for leading/trailing H:|-0-[ScrollView]-0-| (aligned to superview).

I have left/right safeAreaInsets on landscape orientation in iPhone X.

Is it a bug? or I am missing any Apple way that these insets will not be applied when we do not need?

AamirR
  • 11,672
  • 4
  • 59
  • 73

2 Answers2

24

I am using following to skip content inset adjustment:

UIScrollview.contentInsetAdjustmentBehavior = .never

I found that in iOS 11 UIScrollViewContentInsetAdjustmentBehavior.always includes safe area layout guide and apply these margins as insets, so tried .never it worked ))

AamirR
  • 11,672
  • 4
  • 59
  • 73
  • I guess there is no way to fix this in iOS9? I ran into this issue and found a few ways to counter act the issue but non are really elegant and feel more like a hack. So I assume it was a bug in ios9 - 10 which was addressed in iOS11? – TeeJaay Jul 20 '20 at 06:11
0

If you set UIScrollview.contentInsetAdjustmentBehavior = .never, you'll be responsible for applying the insets. If you let to the default value, any time the view needs to be redrawn, the framework will override your settings

Sergiob
  • 838
  • 1
  • 13
  • 28