How to scroll horizontally with ScrollView

There was a scene where I used side-scrolling on the intern, so I will make a note of how to do it!

Place ScrollView

Select scrollView and place it appropriately! スクリーンショット 2021-01-04 15.07.23.png Attach Auto Layout up, down, left and right. But I get an error ⚠️ スクリーンショット 2021-01-04 15.10.43.png I get angry when my whereabouts are ambiguous. スクリーンショット 2021-01-04 15.11.06.png To solve this, put the View on top of the ScrollView. スクリーンショット 2021-01-04 15.13.33.png View extends horizontally to the range you want to scroll horizontally! スクリーンショット 2021-01-04 15.14.35.png This is step 1.

Special Auto Layout

AutoLayout of ScrollView is special and it is done like this. スクリーンショット 2021-01-04 15.18.12.png Hold down the command key, select Content Layout Guide and View, and add Auto Layout as shown in the image. スクリーンショット 2021-01-04 15.18.25.png Hold down the control key and pull from View to Frame Layout Guide to select Equal Widths. スクリーンショット 2021-01-04 15.18.54.png Finally, set the Height of View and the side-scrolling is complete!

Completion (easy to understand)

I put a button in View! スクリーンショット 2021-01-04 15.22.55.png

スクリーンショット 2021-01-04 15.23.00.png By the way, this is the range of ContentLayoutGuideScreenshot 2021-01-04 15.49.08.png Click here for FrameLayout スクリーンショット 2021-01-04 15.50.59.png The range that ContentLayoutGuide scrolls, and the range that FrameLayout displays! !! That was the way to scroll horizontally.

Recommended Posts

How to scroll horizontally with ScrollView
How to number (number) with html.erb
How to update with activerecord-import
How to get started with slim
How to enclose any character with "~"
How to use mssql-tools with alpine
How to get along with Rails
How to start Camunda with Docker
How to crop an image with libGDX
How to adjustTextPosition with iOS Keyboard Extension
How to share files with Docker Toolbox
How to compile Java with VsCode & Ant
[Java] How to compare with equals method
[Android] How to deal with dark themes
How to use BootStrap with Play Framework
[Rails] How to use rails console with docker
How to switch thumbnail images with JavaScript
[Note] How to get started with Rspec
How to do API-based control with cancancan
How to achieve file download with Feign
How to update related models with accepts_nested_attributes_for
How to set JAVA_HOME with Maven appassembler-maven-plugin
How to implement TextInputLayout with validation function
How to handle sign-in errors with devise
How to delete data with foreign key
How to test private scope with JUnit
How to monitor nginx with docker-compose with datadog
How to deal with Precompiling assets failed.
How to achieve file upload with Feign
How to run Blazor (C #) with Docker
How to build Rails 6 environment with Docker
How to deploy
How to download Oracle JDK 8 rpm with curl
[Java] How to test for null with JUnit
How to mock each case with Mockito 1x
How to mock each case with PowerMock + Mockito1x
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
How to save to multiple tables with one input
How to test interrupts during Thread.sleep with JUnit
How to use built-in h2db with spring boot
How to search multiple columns with gem ransack
How to use Java framework with AWS Lambda! ??
[Swift] How to link the app with Firebase
How to create multiple pull-down menus with ActiveHash
How to use Java API with lambda expression
How to get started with Eclipse Micro Profile
How to give your image to someone with docker
How to insert all at once with MyBatis
[Swift UI] How to disable ScrollsToTop of ScrollView
How to monitor SPA site transitions with WKWebView
How to write test code with Basic authentication
[Rails] How to easily implement numbers with pull-down
How to build API with GraphQL and Rails
How to use nfs protocol version 2 with ubuntu 18.04
How to use docker compose with NVIDIA Jetson
How to get resource files out with spring-boot
How to create member variables with JPA Model
How to verify variable items with WireMock's RequestBodyMatching
How to use nginx-ingress-controller with Docker for Mac
[Rails] How to build an environment with Docker
How to avoid exceptions with Java's equals method