[SWIFT] After all, how should I attach the Constraint of ScrollView?

  1. Align the top, bottom, left, and right of the UIScrollView with the View of the UIViewController
  1. Align the top, bottom, left, and right of the Content View with the Content Layout Guide
  2. Align the width of the Content View with the Frame Layout Guide (Equal Widths)
  3. Add an object to the ContentView to determine its height

As the name implies, the Content Layout Guide shows the contents of the UIScrollView, and the Frame Layout Guide shows the frame area of ​​the UIScrollView. https://qiita.com/owen/items/2fab4a4482834b95e349

It was easy to trip

Create ContentView by adding UIView by yourself

I think it's the theory to surround it with UIView, but Apple is a little unfriendly ...

Note the restrictions of the Content Layout Guide

When I put the restrictions on the top, bottom, left, and right of the Content Layout Guide on the ContentView, even if I stretch it to fill the screen and pull the constraint with Ctrl, there is a gap between +315 and +812 for some reason. It's hard to notice by appearance, but be careful as it won't scroll unless you fix it to 0. スクリーンショット 2020-12-31 18.48.43.png スクリーンショット 2021-01-21 10.35.31.png

Determine the height

If you do not add a constraint with ContentView.bottom to the bottom element of the content inside, the height will not be fixed and you will get angry.

A common mistake?

Align bottom of ContentView with Frame Layout Guide

With the correct setting, the lower side may become empty when there are few elements inside. If you match the Bottom of the ContentView to the Frame to fill it, the Frame seems to be the visible part of the top, bottom, left, and right of the iPhone, and the Bottom of the ContentView that should extend further down stops at the bottom of the iPhone and does not scroll (transmitted). スクリーンショット 2021-01-21 10.35.21.png When the contents are small and the bottom is empty, is there no choice but to match the background colors of ContentView and ScrollView to make it look like it is not empty?

Recommended Posts

After all, how should I attach the Constraint of ScrollView?
After all, how should I use Rails callback?
After all I wanted to preview the contents of mysql with Docker ...
What should I do after January 2019 regarding the Java payment issue and Java 8 end of support issue?
I think I understand the reuse of cells, but I don't understand at all.
I examined the concept of the process to understand how Docker works
Don't lose to the unchecked warning! → After all, I couldn't win the unchecked warning ...
I read the source of ArrayList I read
I read the source of Integer
I read the source of Long
I read the source of Short
I read the source of Byte
I read the source of String
[Spring Boot] I investigated how to implement post-processing of the received request.
[Rails] How to solve the time lag of created_at after save method
I investigated the internal processing of Retrofit
How to determine the number of parallels
[day: 5] I summarized the basics of Java
How to sort the List of SelectItem
What I tried when I wanted to get all the fields of a bean
[Beginner] I tried to decorate the bar after displaying the details of the hamburger menu
Do you use the for statement after all? Do you use a while statement? Proper use of for statement and while statement