Come back again.
This is something to talk about two very important aspects of a school to be one of them is called content
size which is the most important one.
And there's another one called the content inset.
So let's go ahead and see how they use either of these to go to school and start a new application.
Obviously I'm going to call it a scroll.
Your content size and the content size is something that they kind of saw it in our previous list and
when we were setting it in this storyboard but this time I want to do it programmatically.
So I'm going to come in here say I have a school for you so you buy a scroll of you and you ask all
of you somebody in here just like the last time I'm going to place it so.
I know I almost always use these for numbers but those are kind of irrelevant.
You can place it whenever you like.
And these are just numbers so maybe at this time I'm going to place a hundred units from the bottom
so place it there and that is going to be or a school of you.
And then I'm going to read a little bit of a different background color.
So she has a light gray color and I'm going to go ahead and make an outfit for it.
So yes.
I'm going to say my school view becomes my scroll of view and that's all I have to do in this story
now is go ahead into our view controller and imagine that we have some contents that we want to add
to this school of you I'm going to say that content is going to be a huge eye view.
So I'm going to severa I'm going to say my read view or any kind of view century is going to be a view.
And then in my view that blog I'm going to go ahead and say My Read view is a view WAIT A C direct and
that's Hegira.
I'm going to make it to be these values.
Let's stick it to the top left corner.
So the top left corner was zero and zero.
I'm going to give it the same it as my a scroll of use.
I'm going to say my scroll view not bounce bounce not bounces bounce out of it.
So I get the better of it and apply it to the weight of my right view and then the height of it I'm
going to put a man who will Number three let's say 2000.
So it's a very very long view a long read of you and I have to make it read as well.
So I'm going to say in my view Dodd's background color becomes you eye color dark red.
So now I have a school of you that I have to fit this red view inside.
So to do that I'm going to say my escrowed view.
I saw you on I'm going to read the view into it now.
The problem is if you're on the application now and nothing is going to happen and to prove that I'm
actually going to do that I'm going to run the application.
And even though all red view is trying to be a view of the 2000 units on the height it is still is not
going to force the school view to as cruel as you can see as much as I try.
Nothing really happens in here and that's simply because the default content size of a scroll of view
is the same size of its boundaries.
So to fix that I have to apply a new size to the content size of my school.
I'm going to go in here and say that my school view not the content sites and is asking for a C.G. size.
I'm going to say it's a CGI size of what I have to provide two values to it and height so their width
and height of this school you have to be the same as the width and height of my Read view if I meant
to completely cover the entirety of the school view with the rest of you.
So I'm going to say that to value as well as 2000.
You could of course place yourself inside at different valuable and I in here over there.
But for now I'm going to say my size is actually 2000.
Let's see what happens now.
Advance my view loads I can see that now I can actually scroll and we see this little indicator on the
right side that is scrolling on the high.
It's the same very principle would be upright if you wanted to make it a score on the horizontal level
which is sometimes happening.
But I would say that most often your school reviews are doing vertical scrolling.
Now we got to see what a scroll view content size is but what is a content inset.
Let me explain that to you.
I'm going to say my scroll view not the content inset.
And that's asking for a UI edge insets.
I'm going to produce a page instead with four values top left by them and right.
So the purpose of the content instead is to essentially make that interaction area of a scroll of view
is smaller than the actual area.
Now you might be wondering where would that be actually useful.
Let me show you an example of how this could actually play to our advantage.
Let me go to storyboard and here in my story what I'm actually going to go ahead and add a button for
the but then I'm going to place it somewhere up here and I'm going to place it like that.
Say it's the heights of maybe 64.
It's a little bit taller and is placed right there in my scroll view is what is not a child of my scroll
view if it's actually a child of the actual Superville and my Badenhorst something like this it has
a background color that is somehow semi-transparent.
I may I a color that is semi-transparent like green like that and semi-transparent.
And then my color may be it is black and then the button says Come to me or something to that effect
that doesn't really matter.
Now I understand the constraints for it.
I'm going to say is constrained to the leading edge to the thrilling.
It is always the same heights and is constantly the top of this scroll of view.
So they both have the same top.
Now the height of my button was 64.
If I remember that I'm going to go in here as the 64 I'm going to go to my view contour and say the
top of it 64 units.
We are not going to see anything left on by them and right.
I'm going to keep it the same.
So like I said you want to change the interaction area of the scroll view.
If you run this application now will see that underneath still.
But then even though we can see it it doesn't distract us from the content.
So you can actually a scroll and the content actually ends right where the burden is.
But then when I scroll they actually go under the button and that actually happens from time to time.
For example in your photos up on your iPhone you can actually a scroll the content under the menu on
the top but yet the content instead allows you to be able to make interaction with the objects that
are under it.
Imagine in this situation if I didn't have the content instead so there would be something like this
at all times some of my content would be on there of the button which is not really a good thing maybe
I wanted to be able to read them properly or I wanted to be able to make interactions with them.
So they use the content instead to make sure that our interaction area is actually different.
Another example I can give you which is something that I've been showing you.
Towards the end of this whole courseware we talk about a all of different solutions is for instance
if you have a text field within this red view and you want to be able to tap on it and start typing
stuff.
So the moment you do that tap the keyboard appears and actually hides that text.
So in a situation like that you actually use the content inset to push the content above as long as
the keyboard is visible.
And that really helps because it allows us to see the content of the text field for as long as the keyboard
is up and also allows us to scroll properly between the score view.
So this was all of us content size and content.
Inset.
Let's move on to our next lesson.