0

Reference: Add a ScrollView to existing View

I inserted a scroll view into an existing view and now my page is not appearing and I am not sure how to fix this. My scroll view is under the view so I do not understand why it is not displaying.

enter image description here

enter image description here

Demetrius
  • 449
  • 1
  • 9
  • 20
  • 1
    Do not post pictures of code. Please copy and paste code as text into your question. Pictures can't be searched or referenced. They are harder to read and putting pictures on your question harder than copying and pasting text. – rmaddy Jun 03 '18 at 20:32
  • That red arrow next to your Login View Controller Scene is an indicator of problems with auto layout. Clicking it will show the ambiguities the layout engine finds. It's likely that your scroll view isn't displaying because it is missing constraints, and rendering zero height. – particleman Jun 03 '18 at 20:36
  • please check https://stackoverflow.com/a/45294116/6080920 – iOS Geek Jun 04 '18 at 05:55

1 Answers1

1

With auto-layout, the UIScrollView needs to be able to calculate its content size using the available constraints. This is often best accomplished by adding a UIView in the scroll view to act as the content view, rather than directly embedding UIControl subclasses. The content view can then be constrained to be equal width and/or equal height to the parent view of the scroll view. The variable height/width (depending on the scroll direction) of the content view can be calculated by fully constraining the widgets it contains.

particleman
  • 635
  • 1
  • 7
  • 12
  • Apple has some reference information about this here: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithScrollViews.html – Remy Baratte Jun 04 '18 at 08:22