I have too many subviews in my ContentView and now I want this contentView in UIScrollview but if I do that I lose all the subview's constraints. Editor->Embed in UIScrollview is not working.
Is there any way to embed ContentView in UIScrollView ? Thanks
Not reliable answer. but fixed by selecting ContentView
Editor->Embed in -> Scroll View
Then Xcode complaining constraints. Clicked on Red button and just selected "Add missing constraints". this fixed for me.
Just select your controls now go on Editor->EmbedIn->View
Perhaps a little tricky, so make sure to have a backup of your storyboard/xib, but if you use 'Open as' > 'Source Code' (control click on the file) and find the view in the XML and change both the opening and closing tag from view
to scrollView
. Now when you do 'Open as' > 'Interface Builder' you got yourself a scroll view instead.
Please note that constraints to the top and bottom of the view default to use the top and bottom layout guides, but if you want it to scroll you need to use top or bottom space to the container view (the scroll view). You can do that by pressing option when creating the constraints.
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