When using Auto Layout, I am unable to set up a simple UIScrollView in my view controller in Xcode 11 beta. I know that I must constrain the scroll view to the edges, and then set the scroll view width and height equal to the width and height of the entire view that contains the scroll view. However, I am not getting the option to set equal widths and heights when I attempt to do so.
When I do the right-click-drag from the scroll view to the entire main view, I get the following options:
In other videos, there is an "Equal Widths" and "Equal Heights" option that I don't seem to have.
Am I doing something wrong, or did Apple change the way scroll views work in Xcode 11?
Overview. UIScrollView is the superclass of several UIKit classes, including UITableView and UITextView . A scroll view is a view with an origin that's adjustable over the content view. It clips the content to its frame, which generally (but not necessarily) coincides with that of the app's main window.
Disabling the content layout guides in the size inspector (ruler icon) in properties
I was having the same issue, and by disabling the option it was gone.
Hope it helps! :)
I stacked with that problem as well. Found a good guide that helped me:
https://useyourloaf.com/blog/scroll-view-layouts-with-interface-builder/
Basically what you need is 9 constraints (assuming you want to scroll only vertically):
1-4: ScrollView to Superview (top, bottom, leading, trailing). Make sure to connect it to parent view and not to safe area.
5-8: Content view to Content Layout guide (top, bottom, leading, trailing).
I also encountered this problem (Version 11.0 beta 3 (11M362v))
. I solved this problem by first setting the layout in xcode10
and then running it in xcode11
. I haven't found any official instructions yet, proving that this is a problem with xcode11, but for now, I guess this is a problem with xcode11
bate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With