So it will come back again in this lesson we're going to talk about something that actually doesn't
have anything to do with the scroll views.
But this is going to become important for us for us.
And that is a you a page controller So if you're wondering whether you are a page control or is it these
little buttons in here the little you know dots that you can tap on and you can essentially scroll scroll
of view.
They could be used for other things as well for most notably they have been used for a school of use
in most you know mobile interfaces both iOS and Android.
So let's see how they're going to use that.
I want to go to this court and start a new application called Page controller.
And again this is a very simple lesson.
So we can get through it really quickly in my story.
I'm going to go ahead and say I need a white page controller which is this guy I'm going to drop it
in here and I'm going to place it somewhere like that.
Maybe make my back in a slightly different color so I can see it and then I'm going to say my page control.
It needs to have a an outlet the same Shirley.
So here I'm going to say this is called My page controller.
And then every time I tap on it I want to have a function and that is an action and I'm going to call
it or page the action.
So this is the one that the page with it.
So let's see how we can do it.
I'm going to go back to my coding interface and in here I'm going to go ahead and say every time that
the paging happens let's get this send.
So I'm going to say you've let my page see TRL.
It is sent there.
I'm going to get it as a new page control.
If that was a valid assumption.
Misprints which page are at.
I'm going to say print page city or L or my page city or dot core and Page tell me we are there right
now.
Format this to a little bit a better one.
You are now at six and then in here I'm going to say Give me one of these and then close it like that.
So it says you are currently at this Koren's page.
And before I run further I actually run the application this week something else as well.
I'm going to see my page one shorter you are viewed at lot.
A number of pages becomes let's say 6 so it has 6 pages and every time that we tap on it it should tell
us which page it is at.
Now let's run our application to see what do we get.
At this point I just realized that because I don't set the constraints we're going to get some sort
of a very weird error but I will explain that in a second.
Let me just change the console and bring it up here so we can see the values.
So if I touch in here we get to the next page on the next page and it shows me you are now the one you
are now at 2.
And if we stop in there we go back to 1.
So it starts from 0 and goes up what's now what I was telling you about about the lack of the constraints
is.
If I type something at the far right or the far left we don't get any interaction and that is because
the size of our interactive view is actually is smaller than the size of these dots.
Let me show you that visually go to a storyboard and select this guy I make it's got a more distinct
color let's say a red color and we run the application again.
You will see that the size of it actually stays like now.
Avoid the dots.
They go outside of it.
So for that reason we can either say let's make this much larger so we know we are safe or properly
set the constraints for it.
I'm going to say it has a leading space constraint at trailing a space and a top a space and then maybe
a changed all the values of the constraints to be zero.
That is the trailing and leading to be zero on the top of it.
I don't care if there is good.
Now I'm going to select the page controller changes color back to the default and now we should be able
to type it anywhere on this page control.
I still see something happening.
And that's exactly what they wanted to see.
Everytime I type on it we get an instruction and every time they do that we get a number changing and
we get one two three four or five and all the other numbers.
And as you can imagine we should find this strategy for ourselves to connect these numbers to the pages
of a scroll view.
Now before I go out of this list and I this is just for a quick reminder of some of the things you have
done in the past nobody really ever does this.
They wanted to remind you of the transforms that we had going in the past.
And for that I'm going to go in here.
Select this guy and I'm going to say let's get rid of all the constraints.
All these three I'm going to make it a little bit smaller.
Maybe something like this.
Misc zoom into here.
Maybe something like that maybe a little bit smaller and I'm going to set the numbers in here so I have
the number of pages six so I can see what's going on.
And then I'm going to go to my view controller.
And once again this is really something you would usually do but just for fun.
And so that we can see things again.
I'm going to see my page contorted that transformed becomes my page controller doth transform and I'm
going to say scaley to boy mesoscale it two times in every direction.
And if I run this now we should be able to see our controller twice as big unbosom width and height.
And that's just you know for better visualization of it I can tap on it than ever and I can get the
you know get the dots to move and we can see the different numbers appearing in here.
So that's about that for using a page controller.
And I will see you in the next lesson.