0

I'm trying to make a ScrollView so that its size adjusts to the size of the text. I placed all the necessary constraints

enter image description here

, but when the application is displayed on the simulator, the content view starts from the safe area and also ends up to the safe area. Although I have pinned scroll view to superview and content view to scroll view.

I want the content to start not from the safe area like here enter image description here,

but from the start of the screen like here

enter image description here

in other words, I want to remove the blue bar from the top and bottom

enter image description here

Do you have any ideas how to do it?

MaratFH
  • 13
  • 3
  • Unclear what the desired goal is. Please draw what you think the "correct" interface would look like. – matt Apr 10 '22 at 15:11
  • Where are the constraints on the rocket view? And what is the blue that is visible at the top? – matt Apr 10 '22 at 15:55
  • Added photo constraints for rocket image. The blue bar on top is part of the scroll view, that is, the scroll view starts from the beginning of the screen, and the content on it is from the safe area. And I want it to start from the beginning of the screen too – MaratFH Apr 10 '22 at 16:19
  • The constraints you have shown indicate that you are doing this correctly for what you want to do. The top of the rocket image is the top of the content view. The top of the content view is the top of the scroll view. The top of the scroll view is the top of the main view. Nothing is connected to the "safe area". I cannot account for the blue area at the top of the screen shot. But if you would like to post this to github as an actual project I'd be happy to look at it for you. – matt Apr 10 '22 at 21:11

1 Answers1

-1

Sometimes UITableView & UIScrollView can still show safe area even though you attach your View to top of Super View. You just need to add one line to solve this issue but make sure your ScrollView is connected to superView not safe area at the top. Add scrollView to your ViewController and in viewDidLoad() just write:

scrollView.ContentInsetAdjustmentBehavior = .never

Check this answer for further details: Make UITableView ignore Safe Area

Mel
  • 429
  • 1
  • 4
  • 12