Will come back again in business then I'm going to show you the zooming feature of a scroll of view
and the only thing you really need to be careful about is that when you zoom within a school view it
is not this scroll of view which is being zoomed right there it's its content that is being zoomed.
So let's see how that actually plays out.
I'm going to start a new application called the scroller view lume.
And once I have done I'm going to head to storyboard and in getting the story what I'm going to have
a UI Escuela view that I'm going to place it somewhere set the constraints to be zero zero zero zero
maybe.
So it's filling the entirety of the screen.
I mean here in the settings I'm going to say it's zoom is not a maximum of one which is the default
behavior it's 4.
So it can actually zoom up to four times.
They have that and then I have to add some content in here.
And for the content I'm going to add a white image of you and I'm going to place this you or you may
have you maybe somewhere like this and I'm going to place it like that and I'm going to carefully set
some constraints for it.
I'm going to say from the top.
It has this much space.
It has a leading space.
It has a trailing space.
It always has the same event as my school view and it has an aspect ratio that says this aspect ratio
of it is going to be one to one.
Let me zoom into here one to one and it sets its height to be always equivalent to it's surveyed.
So the video is controlled by the size of the school view and the height is controlled by the vet.
So we have that and I'm going to add an image to my project.
This is the one I provided you even though you can use any image for it.
And this image is a little bit higher quality because I want it to be able to essentially zoom into
it.
But you could use any image.
Oh they have all of these.
Let's go ahead and add outlets for them.
I'm going to go in here say you my view controller.
I have an outlet for the scroll of view that is going to be called my scroll to view and then I also
have another one.
That is the image of you.
So it's going to be called my image view.
Now you're wondering why do I need the content of this scroll view.
Namely this image of you to have it's own outlet.
You will see that real soon because we need this to be able to say which of you we want to zoom into
it.
Now the last thing after telling my story about what I could do it in the programming side as well is
setting the delegates for our scroll of view.
So I'm going to see him I ask all of you.
It's delegate is the View Controller.
You can do it either here or in programming.
I'm going to show you actually both ways.
So we see them both.
So if you were to do it here you would simply say in my view that load my scroll view that delegate
is is of what you have done this in the story.
We don't need to do it in here.
They don't need to do in here is conforming to that protocol.
The protocol is you write the scroll of your delegates.
Now I need to add two methods in here.
One of them is mandatory.
The other one can just you know have it as an optional thing.
So the first line is this I'm going to save you for zooming.
So he's essentially saying so if you are trying to zoom on the screen view which view you want to zoom
on and I'm going to say returned my e-mail for you if I am assuming police on this one.
So let's go ahead and run this application and see what do we get up until this point.
I'm going to run the app and once I see it on the simulator I'm going to try to hold the old button
on a keyboard because I don't have an actual device on see what we can do when we are zooming on it
and I'm actually zooming into this screen and I zoom further and further it doesn't go more than four
levels and that's simply because of what we have chosen.
Now the other thing that they said you can do in here is an optional is what happens when the zoom ends.
Maybe you want to go back to the original shape so to do that and I don't need to view that door anymore.
I'm going to get rid of that to do that.
I'm going to come in here and say do use that.
And Luma which is part of the delegation met that's when I say let's use the dead end at whatever scale
is going to tell us what scale we ended.
Even though that doesn't really interest me.
What does interest me is this saying my scroll view doth zoom scale let's just push it back to what
and I'm going to write again.
And now in this looming ends we just jump back to where we used to be.
You could either do it like that you will find another very like adding a button or a double click or
something like that that pushes your resume back because that's usually what we want to be able to do.
Otherwise it doesn't really make much sense to do this.
So that's all you have to do in you have to be able to zoom into our school of your resume like this
on a keyboard and a mouse using a simulator holding the Arzt.
And then if you have an actual device doing Penshurst just chill essentially and B set the amount of
the zoom that we can allow for our user in here you could do it programmatically as well.
Setting the zoom Max.
And when we do this zoom we have to decide which view is the view that we will zoom on.
And yeah I set it to be this particular image view.
There are other ways I can think about this.
You might be wondering so what if I have more content and the content is separate pieces up.
That doesn't really happen a lot.
You usually have one large container you view that you have all the content within that.
But if you have a situation that you actually have to have why as you are here and a separate image
of you there with out apparent view then what you want to do is you want to find out your current content
of set and based on that find out which image view you you're seeing and return data one.
Like I said that doesn't really happen all that often.
I have only ever had to deal with a situation like that only once.
But in the next few lessons and we talk about page controllers and the content of set you will learn
how to do that.
And if it comes to it you can actually find out which object you're currently looking at which object
is in the center of your score view at least.
So based on that we can do zooming.
Let's move on to our next lesson.