working with Scrollview in swift and iOS is such a PAIN for real, I do all this in Android with less than a minute! thanks for the video btw, it helped SO MUCH
Thank you so much for this tutorial! Two years later and it’s still helping out. Only tutorial I’ve found that explains effectively how to use scroll view.
Paul is arguably the best ios/swift/Xcode tutor. Each video is clean, concise, exact, and makes learning enjoyable. Thanks again for another great video Paul
There is a lot of information here. I sat down with a note book and took notes as if I was in a lecture. It was too much to simply follow along in Xcode. But as a rookie this is exactly what I needed! I also learned a lot about constraints. Thanks for the video
This is such a great tutorial. I was up until midnight and was brave enough (thanks to this) to rearrange my entire view controller because I didn't have a UIView inside the ScrollView. I think the most important part (for me) was making sure I had a bottom constraint so UIView knew its height.
Thank you!!! I'm not sure which of the settings you carefully walked through in setting up the ScrollView did it, but by 6:32 I had mine working after hours of poking and guessing. I bet it was the 250 priority setting. My ScrollView wasn't even the same size as the SuperView, but I could still interpolate with your clear instructions. Bless you for doing this!
This actually helped me. I couldn't get it to work from other tutorials. I needed a scroll view that wasn't the entire screen though. Simple fix. I just embedded the scroll view in a view and since I only needed a label in the scroll view, I didn't have a view between the scroll view and the label. Thanks for the video.
This is a great tutorial. I think a great phase2 of this video would be another tutorial that has a scroll view with the "twitter & pinterest" effect a.k.a. infinite scrolling until the data source your pulling from runs out.
Hi Paul, I did all how you show, but when I set constraint, my labels suddenly disappeared, when I remove constr., I can see them. What you think why I get like problem and how can I relosve this? P.S. 6:32 timeline P.SS. Its happening when I set last constr., - bottom constr., but if I didn't set, I can't get scroll.
Bad constraints can push a view off screen, you may need to add another constraint to bring it back. (Or you haven't fully constrained it) Try starting over and see if that helps in another sample Xcode project.
Have Xcode 10.2.1, when I right click on any view element I just see the segues, what are you right-clicking (or what options are enabled) to get the constraint context menu?
When I do exactly what you have done here and add constraints like you did on 1:40 I get an error message and red lines around the scroll view, that my scroll view has ambiguous scrollable content hight and width. Can you help me out on that?
It's a good tutorial. The content container was new to me. I see that programming AutoLayout takes a lot of trial and error effort even for an expert like you. Now I don't feel so bad taking so long to learn it.
Yes! It's a big learning experience, and more complex UI's introduce new challenges that you have to use logic to think through. And sometimes the tools behave strangely ... so it's not always your fault.
I don't know off the top of my head, it gets pretty tricky when you do that. Scroll views like to squish content down to the intrinsic content sizes, unless you give them a fixed size.
I tried to delete the labels constraints (top, center and bottom) just to see how would it be and the page stopped scrolling. So I had to add them back in order to get the page scrolling again. Is it possible to keep it scrolling without these labels and their constraints?
I don't know, rules are tricky with the scrollview. It does some magic and expects them a certain way. Programmatic may be easier: th-cam.com/video/GssEIHPPnkE/w-d-xo.html
If it's in a StackView, you can hide it, and the space should adjust. Then if the height of the content is below the height of the screen, you can disable scrolling on the scrollview.
Great idea, thanks Sai! What do you need to do with portrait or landscape? I don't get the issue. Can you explain what you are trying to do? My recommendation is not to support both, most apps pick one, except when they display video content, etc.
I'll have a to refilm a new version with Xcode 12 ... I did a quick time lapse showing how to do this programmatically, but need to actually break it down step by step. th-cam.com/video/GssEIHPPnkE/w-d-xo.html
How does your app look when u run it on a iPhone 8 plus ? I have the Problem when I use the same scroll view on devices with different widths it doesn't fit anymore
It works great! You need to make sure the horizontal layout is explained properly, and not hard coded to specific sizes. Use relative layouts like I describe in my 30 Auto Layout Best Practices guide: blog.supereasyapps.com/30-auto-layout-best-practices/
Makes it low priority. Understanding priorities is something that I plan to create a separate video/blog/book on: pages.convertkit.com/e119bf9a85/858c1c1a46
Hey thanks for this super informative video! I have a question about the auto layout tho. I am working on an app which requires scroll view in a tab bar controller which also has a navigation bar. How should I go about setting up the auto layout so that I am able to display things and scroll smoothly. Really lost as to how I should approach this, any help would be greatly appreciated! Cheers!
You probably want to put the button on top of the scroll view with special constraints that keep it visible all the time, don't put it inside the content.
Hey Can you please teach us how to make the scroll view expand with the UITextfield as it expands? i made the uitextfield expand itself until the bottom of the scroll view but the scroll view is fixed and it could't expand. thanks ;))
You should use a text area instead of a UITextField. Set a maximum height for the view. Don't make it expand. Or if you do, just control the text area's height constraint constant programmatically.
Only if I could I would pin this video's url on the TH-cam homepage so that people don't waste time searching for scroll views when they can access the gem directly! Amazing shit man 🔥
This video is really good . But i have a question , if we have to add some ui dynamically in our content view . So scroll view adjust automatically scroll content or not .
The reason why you couldn’t rename the view at around 2:45 is likely due to whatever software you’ve installed to highlight your screen clicks; regardless, selecting the view (indicated by blue highlight) and then pressing Enter (or Return) would have allowed to you to rename it.
I don't have any mouse highlights, and I'm not sure what happened here. Probably restarting Xcode would fix this glitch. Enter definitely works. I didn't remember to do that when I was creating the video. Thanks for the reminder!
Good tutorial. Paul, you indicated that this same thing could be done programmatically. Any suggestions of a reference on how to do this? I have an application where I need to add the constraints programmatically instead of in the storyboard.
That's a good idea for a followup video. Thanks Tim! You'll have to programmatically add the layout constraints using the Anchors API, which I cover in my Learn Auto Layout Fast course. It's not open yet, but I'll be opening enrollment soon: supereasyapps.com/autolayout/
Hi great tutorial! I get an error immediately after adding all scroll view constraints suggesting scroll view height and width are ambiguous? It doesn't offer an xcode fix. Any ideas?
Awesome! That's not a standard behavior on iOS, so I would not recommend. Customers on iOS are used to the rubberband snap effect. With that said, you can adjust the scroll position programmatically, but it make "pop" without hand tweaking it a ton.
I come back to this video every few months when I need a scroll view - that's how unintuitive it is to me! Thanks so much for this!!
It's tough. It's all or nothing and if you mix up one step it can leave you super confused.
working with Scrollview in swift and iOS is such a PAIN for real, I do all this in Android with less than a minute! thanks for the video btw, it helped SO MUCH
There are some easier ways, I need to make some new tutorials.
This is so true, such a pain, I'm trying to create iOS version of my app and scroll is such a pain
After 30 years, Apple recognizes they did something bad with AutoLayout. So, we have SwiftUI since last year. AutoLayout is a hate-love relationship.
@@sedraopamp Auto Layout works, but you have to get the rules and priorities right. If you try to muddle through it, you'll tear out your hair.
so true. ios development is terrible compared to android. Can't understand apple fanboys here and their hate towards android...
I've been doing iOS programming for 3+ years now, but still learned some shortcuts and storyboard ticks in this video. Bravo!
Awesome, I should do a keyboard shortcuts video. Great idea.
This works in 2020 with Xcode 11.4. Thanks Paul 👍
Awesome!
Thank you so much for this tutorial! Two years later and it’s still helping out. Only tutorial I’ve found that explains effectively how to use scroll view.
Thanks Colby! I need to make a new one. =)
Just started getting into Autolayout after 6 years of development.. this just saved my life haha, thanks man
Awesome. It's tough.
Paul is arguably the best ios/swift/Xcode tutor. Each video is clean, concise, exact, and makes learning enjoyable. Thanks again for another great video Paul
Thanks Brian! I hope you're doing well.
There is a lot of information here. I sat down with a note book and took notes as if I was in a lecture. It was too much to simply follow along in Xcode. But as a rookie this is exactly what I needed!
I also learned a lot about constraints.
Thanks for the video
Great work Jonathan, I'll try and include additional notes in my new videos like this one: th-cam.com/video/8DHNEXcj-w4/w-d-xo.html
This is such a great tutorial. I was up until midnight and was brave enough (thanks to this) to rearrange my entire view controller because I didn't have a UIView inside the ScrollView. I think the most important part (for me) was making sure I had a bottom constraint so UIView knew its height.
Yes, keep it up!
It’s funny you replied to this now Paul, I had to pull it up again this week. Thanks again.
@@itsadamoc =) Have fun with it. I may have an update in the upcoming year.
Just started with iOS app development and this video gave me so much clarity on how UIscrollviews worked. Thank you so much!
Great! There's so much hidden complexity, I hope you're learning a lot.
This one of the best video for understanding and clearing all the confusion on scrolling issues in UIViewController
Thanks!
Thank you!!! I'm not sure which of the settings you carefully walked through in setting up the ScrollView did it, but by 6:32 I had mine working after hours of poking and guessing. I bet it was the 250 priority setting. My ScrollView wasn't even the same size as the SuperView, but I could still interpolate with your clear instructions. Bless you for doing this!
Great work Jeff, this is hard work. The feedback loop is slow, and the rules become complex quickly.
Man you saved me. This was the best video i could find!!!!!
I’m glad it helped
This actually helped me. I couldn't get it to work from other tutorials. I needed a scroll view that wasn't the entire screen though. Simple fix. I just embedded the scroll view in a view and since I only needed a label in the scroll view, I didn't have a view between the scroll view and the label. Thanks for the video.
Great work!
Best Xcode/Swift instruction on the web, bar none. Thanks!
Thanks Brian!
Thank you so much. I had been bashing my head against a wall of scrollview nightmares. Tried everything. This fixed it. Thank you!
Awesome work James! I need to do a programmatic video one of these days.
I teach our Lambda School students how to do that.
I was just in class being taught by you, and now came here to watch this to finish my student project 🤦♂️ Paul is everywhere and the best!
Thanks Ezra!
This is a great tutorial. I think a great phase2 of this video would be another tutorial that has a scroll view with the "twitter & pinterest" effect a.k.a. infinite scrolling until the data source your pulling from runs out.
Thanks Payton! That's a great idea to do a phase 2 project with infinite scrolling. Thanks for the suggestion, I'll add it to my request list. =)
Paul Solt Hello Paul. Any chances this phase 2 tutorial has been released?
@@fabiomoggi These are mainly implemented with tableviews and collection views, it is much easier to handle with that.
Thank you so much for this amazing ScrollView tutorial. You are a life savior!
Good work Bogdan! Hard topic.
yep. trying to set up constraints without making a 'content view' was a pain in the ass. glad I found this video
Excellent! It's tricky, this seems to work better with the Content View. =)
Good job. You are further along using the right click to access constraints, but I need to lean in that direction.
THANK YOU SO MUCH! i'm SouthKorean ,and i was searching google, but i can't do that.... but finally you save me!
Great work!
Fantastic video and example project. I would've never thought to change the height priority - videos like this make Swift a usable language!
Great work Dan, what did you build?
Your videos are always super helpful. Thanks Paul!
Thank you Joseph!
Hi Paul, I did all how you show, but when I set constraint, my labels suddenly disappeared, when I remove constr., I can see them. What you think why I get like problem and how can I relosve this?
P.S.
6:32 timeline
P.SS.
Its happening when I set last constr., - bottom constr., but if I didn't set, I can't get scroll.
Bad constraints can push a view off screen, you may need to add another constraint to bring it back. (Or you haven't fully constrained it)
Try starting over and see if that helps in another sample Xcode project.
Have Xcode 10.2.1, when I right click on any view element I just see the segues, what are you right-clicking (or what options are enabled) to get the constraint context menu?
VPSantiago same issue here! Did you figure it out? Thanks
Right click and drag to another element
Thank you so much! This really helped me a lot! Been using hours trying to figure this out
Awesome, keep up the hard work!
When I do exactly what you have done here and add constraints like you did on 1:40 I get an error message and red lines around the scroll view, that my scroll view has ambiguous scrollable content hight and width. Can you help me out on that?
Oh okay, I just followed your steps ahead and the red lines and error messages disappeared :-) Thank you so much for that great video!!
Sometimes I restart and it works ... little mistakes can break it quickly. It's very error prone.
Thank you so very much, Paul. Your video really helped me to understand scroll view
Woohoo! That's great Gabil!
Great tutorial, very very helpful. It's not easy to find proper information on this topic. Thanks!
Thanks Paulo!
6:10 if I do the vertical spacing and starting the app, the labels disappear and it is not scrollable :/
ok its working now. I forgot the priority level 🤦🏽♂️
@@TheSpiralnotizblock Great fix! It's tough.
Thanks so much! I was really struggling to get my scroll view set up. Your video and github repo saved me!
Excellent! What are you making?
Paul Solt I was actually just messing about. But I was using the NASA picture of the day API to create a view. Thanks again!
Great idea! I haven't used their API, but that sounds super fun to play with!
I might have to make a demo app using it. Thanks, Muhammad!
Awesome video. It solved a lot of my problems. Thank you so much.
It's a good tutorial. The content container was new to me. I see that programming AutoLayout takes a lot of trial and error effort even for an expert like you. Now I don't feel so bad taking so long to learn it.
Yes! It's a big learning experience, and more complex UI's introduce new challenges that you have to use logic to think through. And sometimes the tools behave strangely ... so it's not always your fault.
Fantastic Video! Lowering the Priority of the Width/Height of the Content View is just what I needed to know, thanks man!
It's tricky, I should do more videos on this topic.
Thanks so much for this tutorial. I have finally understood how to design such long content areas. Great video!
Awesome work Andrew!
Awesome video. Even with newer versions of Xcode it still makes sense and is paced well
Great! Sometimes things change, we'll see with Xcode 12
thank you so much! you saved me a psychiatrist. The scrollview drove me crazy
Good work! It's tricky to work with Scroll Views.
Thank you for this! I cant thank you enough! Keep putting out more videos!
Thanks Domenico, Auto Layout + Scroll Views are hard. I want to do some programmatic Scroll View videos.
Really nice tutorial Paul Solt ....it is very helpful for me .Thanks a lot !
Awesome! =) What are you using the ScrollView for?
Great, thanks for the clear and precise introduction to scroll views!
You're welcome! Enjoy it!
Have you updated this for Xcode 11.3 . This does not appear to work any longer. Thanks
Dan, I'll need to make a new tutorial for Xcode 12, thanks! This is very tricky.
Thank you. Is there any way to do Relation with Less Than or Equal after giving scrollView Height Constraint as a large value?
I don't know off the top of my head, it gets pretty tricky when you do that. Scroll views like to squish content down to the intrinsic content sizes, unless you give them a fixed size.
I tried to delete the labels constraints (top, center and bottom) just to see how would it be and the page stopped scrolling. So I had to add them back in order to get the page scrolling again. Is it possible to keep it scrolling without these labels and their constraints?
I don't know, rules are tricky with the scrollview. It does some magic and expects them a certain way. Programmatic may be easier: th-cam.com/video/GssEIHPPnkE/w-d-xo.html
This is the only great tutorial on the net it seems for the UIScrollView. When can we expect a refreshed video using the Xcode 11 Scroll View element?
In the near future ... I don't have an ETA yet. Working on getting back into my writing habit, videos will follow.
finally some good example without mistical invisible spacers
=)
How do you load the page where it would start at the bottom of the scrolled page? Thanks!
Change your contentOffset position
Hey Paul. Nice tutorial. The next step would be how to make the size dynamic so that the Content View expands as the content expands.
Great idea for a future tutorial on Auto Layout for accessibility or dynamic content.
İf you hide button at the bottom at run time how would you remove space at the below of textfield and make this page non scrollable ?
If it's in a StackView, you can hide it, and the space should adjust. Then if the height of the content is below the height of the screen, you can disable scrolling on the scrollview.
Super helpful vid. Thanks. I am finally writing this all down.
Great! It's difficult, I ran into issues doing it programmatically: th-cam.com/video/GssEIHPPnkE/w-d-xo.html
Clear and up to the point. Thanks buddy
You bet!
I tried adding a background image but every time I tried to do this I get errors. What do I need to do to make it work?
Set a max height for the image?
How do I use this same method for a horizontal scroll view? I have been trying to apply the same logic but horizontally and I can't make it work.
That's tricky if you don't have the text width constrained. Make sure you specify how wide a text area or image can be.
One of my bottom constraints isn't working correctly and now my label is very large in comparison to the rest of the items on my app. Any advice?
You need to increase the content hugging priority so it doesn't stretch.
Paul Solt thank you
very informative video on scrollview. Can you make a video on how to handle scrollview in portrait mode and landscape mode
Great idea, thanks Sai! What do you need to do with portrait or landscape? I don't get the issue.
Can you explain what you are trying to do?
My recommendation is not to support both, most apps pick one, except when they display video content, etc.
I think your tutorial is not working with Xcode 11. Can you please fix it for universal app (iPhone, iPad and Mac)
I'll have a to refilm a new version with Xcode 12 ... I did a quick time lapse showing how to do this programmatically, but need to actually break it down step by step. th-cam.com/video/GssEIHPPnkE/w-d-xo.html
Great Tutorial Thanx.
Can you tell me why you delete the Height Beam
We want to self size
This tutorial was very helpful for me. Thank you very much!
You're welcome Terrance!
Finally solve the problem , thanks for your video . It's good for beginners!!!!!
Awesome!
It works great. Thanks Paul.
One question - why you stopped creating videos?
I haven't had time, as I've been working full-time teaching iOS at Lambda School.
Hopefully, I'll be able to start making some new content in the near future.
@@PaulSolt can you share the syllabus of your class? Like what all topics you cover and duration
@@iOSTechie lambdaschool.com/courses/ios-development
for vertical spacing ?
add constraints to space
How does your app look when u run it on a iPhone 8 plus ?
I have the Problem when I use the same scroll view on devices with different widths it doesn't fit anymore
It works great!
You need to make sure the horizontal layout is explained properly, and not hard coded to specific sizes. Use relative layouts like I describe in my 30 Auto Layout Best Practices guide: blog.supereasyapps.com/30-auto-layout-best-practices/
What is the importance of setting the priority height constraint to 250?
Makes it low priority. Understanding priorities is something that I plan to create a separate video/blog/book on: pages.convertkit.com/e119bf9a85/858c1c1a46
Thanks, men, your tutorial helped me a lot and saved me a lot of time. thanks again
Keep it up!
thank you so much, worked with Xcode 10.3 and swift 5.
Great!
As always this is great tutorial, I like your videos very much. Thank you.!
Thanks!
Hey thanks for this super informative video! I have a question about the auto layout tho. I am working on an app which requires scroll view in a tab bar controller which also has a navigation bar. How should I go about setting up the auto layout so that I am able to display things and scroll smoothly. Really lost as to how I should approach this, any help would be greatly appreciated!
Cheers!
Same way, you just need to contain the scroll view controller within the tab bar.
It's scrolling but my buttons stay on screen, please help
You probably want to put the button on top of the scroll view with special constraints that keep it visible all the time, don't put it inside the content.
it says that need constrains for X Position
Make sure you follow step by step, if it's not properly setup it will not be happy.
Hey thanks so much for that, I was going nuts trying to lay out stuff in a scroll view and that unlocked the mystery ;-)
Awesome!
It would be interesting to see the same done with UIStackView instead of settings explicit constraints to each view inside the content view...
Good idea
Why you are setting low priority?
Sometimes you need to break a "tie" by changing priority
thanks a lot sir its very helpful and very simple to undrsatnd
how do we know which portion of scroll view is on the screen?
It always starts at the top, unless you programmatically scroll.
Hey Can you please teach us how to make the scroll view expand with the UITextfield as it expands? i made the uitextfield expand itself until the bottom of the scroll view but the scroll view is fixed and it could't expand. thanks ;))
You should use a text area instead of a UITextField. Set a maximum height for the view. Don't make it expand. Or if you do, just control the text area's height constraint constant programmatically.
Thanks bro! I was going nuts trying
Glad I could help
Thanks for this video. It is pretty useful for my current situation..
Excellent! Keep it up
Only if I could I would pin this video's url on the TH-cam homepage so that people don't waste time searching for scroll views when they can access the gem directly! Amazing shit man 🔥
Thanks! Just subscribe for new videos. More Auto Layout topics are coming after I finish my new book: pages.convertkit.com/e119bf9a85/858c1c1a46
Thank you! So useful tutorial!
You're very welcome!
This video is really good . But i have a question , if we have to add some ui dynamically in our content view . So scroll view adjust automatically scroll content or not .
Use a Stackview to contain a group of dynamic content.
The reason why you couldn’t rename the view at around 2:45 is likely due to whatever software you’ve installed to highlight your screen clicks; regardless, selecting the view (indicated by blue highlight) and then pressing Enter (or Return) would have allowed to you to rename it.
I don't have any mouse highlights, and I'm not sure what happened here. Probably restarting Xcode would fix this glitch.
Enter definitely works. I didn't remember to do that when I was creating the video. Thanks for the reminder!
why its not scrolling? Doing the same step.
Very error prone, start over and try again. Did you get it?
Really helpful video. It solved my problem. thank you.
Enjoy!
Good tutorial. Paul, you indicated that this same thing could be done programmatically. Any suggestions of a reference on how to do this? I have an application where I need to add the constraints programmatically instead of in the storyboard.
That's a good idea for a followup video. Thanks Tim!
You'll have to programmatically add the layout constraints using the Anchors API, which I cover in my Learn Auto Layout Fast course. It's not open yet, but I'll be opening enrollment soon: supereasyapps.com/autolayout/
VERY VERY helpful. Thanks!!!
Thanks, keep it up Phontaine.
Hi great tutorial! I get an error immediately after adding all scroll view constraints suggesting scroll view height and width are ambiguous? It doesn't offer an xcode fix. Any ideas?
Make sure you follow it exactly, and Xcode may have changed ... so it's pretty difficult. Did you figure it out?
Hey Thanks for this! is there any way to make the scroll view a loop? so it goes back to the top or keeps going down?
Awesome! That's not a standard behavior on iOS, so I would not recommend. Customers on iOS are used to the rubberband snap effect.
With that said, you can adjust the scroll position programmatically, but it make "pop" without hand tweaking it a ton.
This tutorial helped me a lot!Thanks!!!!
You're welcome!
Thanks, you saved my life. i was missing bottom constraint
That's always tricky. =)
does this work in landscape mode ?????
Should still work, but you may or may not need to adjust offsets to keep the same content on screen, especially if you rearrange anything.
Thanks for the tutorial!! Just what I was looking for!! You just adquiere a new sub!
Awesome =)
thanks, Paul! This was a lot of help!
awesome! =)
Thank you Paul. You've made my day.
Awesome! Thanks for sharing Johnathan! How are you using Auto Layout in your app?
Solid video. Good work
Thanks !
Thanks for your tutorial. Very useful.
Awesome! What are you making?
huge help, thank Paul
Great work Jon! This is tough.
Hello Mr. Solt,
The video is good and helpful! Thank you!
Awesome, thanks for letting me know. What are you making?
Hello Mr. Solt, I am making a directroy like app. Just an app showing a lot of names of companys.
Awesome, that sounds fun, keep it up, Jones!
Thank you very much Mr. Slot!
many thanks! you helped today!
Great work Laurent! Enjoy coding
Thanks Man!!! This was really helpful!!
Great!
Awesome, very nice explanation!
Thanks Prem!