1
00:00:00,610 --> 00:00:05,820
Will come back again in business then I'm going to show you the zooming feature of a scroll of view

2
00:00:05,940 --> 00:00:11,070
and the only thing you really need to be careful about is that when you zoom within a school view it

3
00:00:11,070 --> 00:00:16,380
is not this scroll of view which is being zoomed right there it's its content that is being zoomed.

4
00:00:16,530 --> 00:00:18,500
So let's see how that actually plays out.

5
00:00:18,510 --> 00:00:25,710
I'm going to start a new application called the scroller view lume.

6
00:00:26,430 --> 00:00:31,740
And once I have done I'm going to head to storyboard and in getting the story what I'm going to have

7
00:00:31,770 --> 00:00:39,570
a UI Escuela view that I'm going to place it somewhere set the constraints to be zero zero zero zero

8
00:00:39,570 --> 00:00:40,170
maybe.

9
00:00:40,170 --> 00:00:42,780
So it's filling the entirety of the screen.

10
00:00:42,840 --> 00:00:49,580
I mean here in the settings I'm going to say it's zoom is not a maximum of one which is the default

11
00:00:49,590 --> 00:00:51,140
behavior it's 4.

12
00:00:51,330 --> 00:00:54,970
So it can actually zoom up to four times.

13
00:00:55,110 --> 00:00:58,040
They have that and then I have to add some content in here.

14
00:00:58,040 --> 00:01:03,370
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

15
00:01:03,370 --> 00:01:08,220
have you maybe somewhere like this and I'm going to place it like that and I'm going to carefully set

16
00:01:08,220 --> 00:01:09,390
some constraints for it.

17
00:01:09,390 --> 00:01:10,810
I'm going to say from the top.

18
00:01:10,860 --> 00:01:12,790
It has this much space.

19
00:01:12,930 --> 00:01:14,780
It has a leading space.

20
00:01:14,820 --> 00:01:17,100
It has a trailing space.

21
00:01:17,250 --> 00:01:26,460
It always has the same event as my school view and it has an aspect ratio that says this aspect ratio

22
00:01:26,460 --> 00:01:30,020
of it is going to be one to one.

23
00:01:30,150 --> 00:01:38,600
Let me zoom into here one to one and it sets its height to be always equivalent to it's surveyed.

24
00:01:38,610 --> 00:01:43,580
So the video is controlled by the size of the school view and the height is controlled by the vet.

25
00:01:43,770 --> 00:01:47,910
So we have that and I'm going to add an image to my project.

26
00:01:47,910 --> 00:01:52,060
This is the one I provided you even though you can use any image for it.

27
00:01:52,060 --> 00:01:57,440
And this image is a little bit higher quality because I want it to be able to essentially zoom into

28
00:01:57,450 --> 00:01:57,610
it.

29
00:01:57,630 --> 00:01:59,440
But you could use any image.

30
00:01:59,640 --> 00:02:00,690
Oh they have all of these.

31
00:02:00,690 --> 00:02:02,770
Let's go ahead and add outlets for them.

32
00:02:02,790 --> 00:02:07,380
I'm going to go in here say you my view controller.

33
00:02:07,500 --> 00:02:15,930
I have an outlet for the scroll of view that is going to be called my scroll to view and then I also

34
00:02:15,930 --> 00:02:17,070
have another one.

35
00:02:17,070 --> 00:02:18,420
That is the image of you.

36
00:02:18,450 --> 00:02:22,240
So it's going to be called my image view.

37
00:02:22,260 --> 00:02:26,130
Now you're wondering why do I need the content of this scroll view.

38
00:02:26,160 --> 00:02:29,550
Namely this image of you to have it's own outlet.

39
00:02:29,610 --> 00:02:35,610
You will see that real soon because we need this to be able to say which of you we want to zoom into

40
00:02:35,630 --> 00:02:36,290
it.

41
00:02:36,390 --> 00:02:41,430
Now the last thing after telling my story about what I could do it in the programming side as well is

42
00:02:41,430 --> 00:02:43,930
setting the delegates for our scroll of view.

43
00:02:43,940 --> 00:02:45,680
So I'm going to see him I ask all of you.

44
00:02:45,960 --> 00:02:48,050
It's delegate is the View Controller.

45
00:02:48,050 --> 00:02:50,710
You can do it either here or in programming.

46
00:02:50,730 --> 00:02:52,400
I'm going to show you actually both ways.

47
00:02:52,400 --> 00:02:53,760
So we see them both.

48
00:02:53,940 --> 00:03:01,120
So if you were to do it here you would simply say in my view that load my scroll view that delegate

49
00:03:01,210 --> 00:03:04,460
is is of what you have done this in the story.

50
00:03:04,520 --> 00:03:06,030
We don't need to do it in here.

51
00:03:06,100 --> 00:03:10,130
They don't need to do in here is conforming to that protocol.

52
00:03:10,130 --> 00:03:14,340
The protocol is you write the scroll of your delegates.

53
00:03:14,430 --> 00:03:17,180
Now I need to add two methods in here.

54
00:03:17,220 --> 00:03:19,230
One of them is mandatory.

55
00:03:19,230 --> 00:03:22,470
The other one can just you know have it as an optional thing.

56
00:03:22,500 --> 00:03:27,410
So the first line is this I'm going to save you for zooming.

57
00:03:27,660 --> 00:03:34,320
So he's essentially saying so if you are trying to zoom on the screen view which view you want to zoom

58
00:03:34,320 --> 00:03:42,350
on and I'm going to say returned my e-mail for you if I am assuming police on this one.

59
00:03:42,570 --> 00:03:46,600
So let's go ahead and run this application and see what do we get up until this point.

60
00:03:46,620 --> 00:03:51,810
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

61
00:03:51,870 --> 00:03:59,030
on a keyboard because I don't have an actual device on see what we can do when we are zooming on it

62
00:03:59,150 --> 00:04:06,090
and I'm actually zooming into this screen and I zoom further and further it doesn't go more than four

63
00:04:06,090 --> 00:04:09,510
levels and that's simply because of what we have chosen.

64
00:04:09,510 --> 00:04:15,300
Now the other thing that they said you can do in here is an optional is what happens when the zoom ends.

65
00:04:15,330 --> 00:04:20,340
Maybe you want to go back to the original shape so to do that and I don't need to view that door anymore.

66
00:04:20,340 --> 00:04:22,700
I'm going to get rid of that to do that.

67
00:04:22,710 --> 00:04:27,210
I'm going to come in here and say do use that.

68
00:04:27,390 --> 00:04:36,510
And Luma which is part of the delegation met that's when I say let's use the dead end at whatever scale

69
00:04:36,540 --> 00:04:39,320
is going to tell us what scale we ended.

70
00:04:39,600 --> 00:04:41,960
Even though that doesn't really interest me.

71
00:04:42,090 --> 00:04:51,400
What does interest me is this saying my scroll view doth zoom scale let's just push it back to what

72
00:04:51,940 --> 00:04:53,670
and I'm going to write again.

73
00:04:54,030 --> 00:04:58,440
And now in this looming ends we just jump back to where we used to be.

74
00:04:58,440 --> 00:05:03,890
You could either do it like that you will find another very like adding a button or a double click or

75
00:05:03,890 --> 00:05:09,820
something like that that pushes your resume back because that's usually what we want to be able to do.

76
00:05:09,890 --> 00:05:13,730
Otherwise it doesn't really make much sense to do this.

77
00:05:14,090 --> 00:05:18,890
So that's all you have to do in you have to be able to zoom into our school of your resume like this

78
00:05:18,990 --> 00:05:22,710
on a keyboard and a mouse using a simulator holding the Arzt.

79
00:05:22,710 --> 00:05:29,280
And then if you have an actual device doing Penshurst just chill essentially and B set the amount of

80
00:05:29,280 --> 00:05:34,810
the zoom that we can allow for our user in here you could do it programmatically as well.

81
00:05:34,820 --> 00:05:36,760
Setting the zoom Max.

82
00:05:36,850 --> 00:05:42,850
And when we do this zoom we have to decide which view is the view that we will zoom on.

83
00:05:43,000 --> 00:05:45,680
And yeah I set it to be this particular image view.

84
00:05:45,770 --> 00:05:47,780
There are other ways I can think about this.

85
00:05:47,780 --> 00:05:53,530
You might be wondering so what if I have more content and the content is separate pieces up.

86
00:05:53,540 --> 00:05:55,000
That doesn't really happen a lot.

87
00:05:55,010 --> 00:06:01,060
You usually have one large container you view that you have all the content within that.

88
00:06:01,130 --> 00:06:06,860
But if you have a situation that you actually have to have why as you are here and a separate image

89
00:06:06,860 --> 00:06:12,840
of you there with out apparent view then what you want to do is you want to find out your current content

90
00:06:12,850 --> 00:06:20,030
of set and based on that find out which image view you you're seeing and return data one.

91
00:06:20,030 --> 00:06:22,370
Like I said that doesn't really happen all that often.

92
00:06:22,370 --> 00:06:26,120
I have only ever had to deal with a situation like that only once.

93
00:06:26,130 --> 00:06:32,000
But in the next few lessons and we talk about page controllers and the content of set you will learn

94
00:06:32,000 --> 00:06:33,040
how to do that.

95
00:06:33,050 --> 00:06:40,130
And if it comes to it you can actually find out which object you're currently looking at which object

96
00:06:40,130 --> 00:06:42,800
is in the center of your score view at least.

97
00:06:42,800 --> 00:06:45,870
So based on that we can do zooming.

98
00:06:46,040 --> 00:06:47,780
Let's move on to our next lesson.
