How To Get Only Vertical Scrollbar

How to create a vertical only UIScrollView in Xcode and Swift

Hi. This tutorial will show you how to create a vertical only scrollview. Let's start bycreating a quot;New Projectquot;. Select quot;Single View Applicationquot;. Choose a quot;Product Namequot;. Make sure quot;Languagequot; is set to quot;Swiftquot; and quot;Devicesquot; are set to Universalquot;. quot;Createquot;. Let me resize my workspace to have a bit more room to work. First, let's change the main view background color sothat when we reach the bottom of the

scrollview, the colours will match. We will see that when we finish the tutorial. I will chose a light orange color. Next, we add a UIScrollView to our main view and resize it to the same width and height of the main view, but leaving a space for the “Status Bar�. Then we pin the scrollview to the main view. Be sure to deselect “Constrain to margins� option, then select the top, left, right and bottom constrains and click on the “Add Constrains� button. Now that our scrollview is ready, let's add a UIView on top of the scrollView. This view is going to be the content view that will hold all buttons, controls you may add to your app.

Adjust the view to match the scrollView width and height. Change its background to the same light orange color to match the main view background. Then we pin the view to the scrollview top, left, right and bottom, and set the height, for example, to 1000. Now we go to our quot;Document Outline� and select the view we just added. Then we ctrl + click and drag to the main view and select “Equal Widths� on the pop up menu so that the content view will have the same width as the main view. Next step is to change the content view height size

and set it to match the constraint size we set earlier, which is 1000. After that we can see that we have no autolayout issues. Now, we select our View Controller and change its size on Size Inspector to match the view size. We do this because then we will have all vertical space to work with the user interface and after you finish you can change it back to the default. Finally we add two buttons for testing the project, one at the top and one at the bottom of the view and we set their constrains. Build and run the project and let's see how it works.

I'm selecting the iPhone 4s for its smaller screen size and test the scrolling. We scroll up and down and it just works. Without sidewayshorizontal scrolling. And that's it. I hope this helps you. Thanks for watching and see you soon.

Smooth Scrolling in Windows 10 I One Simple Trick

Smooth Scrolling in Windows 10 I One Simple Trick! right click system advanced settings uncheck! apply ok

feel the difference!.

Leave a Reply