1
00:00:00,510 --> 00:00:05,300
So it will come back again in this lesson we're going to talk about something that actually doesn't

2
00:00:05,300 --> 00:00:07,190
have anything to do with the scroll views.

3
00:00:07,340 --> 00:00:09,570
But this is going to become important for us for us.

4
00:00:09,590 --> 00:00:15,440
And that is a you a page controller So if you're wondering whether you are a page control or is it these

5
00:00:15,440 --> 00:00:21,390
little buttons in here the little you know dots that you can tap on and you can essentially scroll scroll

6
00:00:21,390 --> 00:00:21,810
of view.

7
00:00:21,920 --> 00:00:26,670
They could be used for other things as well for most notably they have been used for a school of use

8
00:00:26,930 --> 00:00:31,420
in most you know mobile interfaces both iOS and Android.

9
00:00:31,580 --> 00:00:33,490
So let's see how they're going to use that.

10
00:00:33,500 --> 00:00:38,780
I want to go to this court and start a new application called Page controller.

11
00:00:38,790 --> 00:00:40,890
And again this is a very simple lesson.

12
00:00:41,000 --> 00:00:44,780
So we can get through it really quickly in my story.

13
00:00:44,830 --> 00:00:50,870
I'm going to go ahead and say I need a white page controller which is this guy I'm going to drop it

14
00:00:50,870 --> 00:00:53,720
in here and I'm going to place it somewhere like that.

15
00:00:53,870 --> 00:01:01,060
Maybe make my back in a slightly different color so I can see it and then I'm going to say my page control.

16
00:01:01,090 --> 00:01:04,810
It needs to have a an outlet the same Shirley.

17
00:01:04,910 --> 00:01:11,790
So here I'm going to say this is called My page controller.

18
00:01:12,230 --> 00:01:18,620
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

19
00:01:18,620 --> 00:01:21,440
it or page the action.

20
00:01:21,610 --> 00:01:23,920
So this is the one that the page with it.

21
00:01:24,200 --> 00:01:26,260
So let's see how we can do it.

22
00:01:26,300 --> 00:01:32,510
I'm going to go back to my coding interface and in here I'm going to go ahead and say every time that

23
00:01:32,510 --> 00:01:35,570
the paging happens let's get this send.

24
00:01:35,750 --> 00:01:40,860
So I'm going to say you've let my page see TRL.

25
00:01:41,080 --> 00:01:42,840
It is sent there.

26
00:01:43,160 --> 00:01:47,060
I'm going to get it as a new page control.

27
00:01:47,150 --> 00:01:49,130
If that was a valid assumption.

28
00:01:49,150 --> 00:01:51,370
Misprints which page are at.

29
00:01:51,380 --> 00:02:01,340
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

30
00:02:01,400 --> 00:02:01,860
now.

31
00:02:01,930 --> 00:02:04,420
Format this to a little bit a better one.

32
00:02:04,460 --> 00:02:13,280
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.

33
00:02:13,370 --> 00:02:17,670
So it says you are currently at this Koren's page.

34
00:02:17,780 --> 00:02:22,870
And before I run further I actually run the application this week something else as well.

35
00:02:22,880 --> 00:02:26,280
I'm going to see my page one shorter you are viewed at lot.

36
00:02:26,420 --> 00:02:33,800
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

37
00:02:33,800 --> 00:02:35,780
us which page it is at.

38
00:02:35,780 --> 00:02:38,600
Now let's run our application to see what do we get.

39
00:02:38,600 --> 00:02:44,150
At this point I just realized that because I don't set the constraints we're going to get some sort

40
00:02:44,150 --> 00:02:48,050
of a very weird error but I will explain that in a second.

41
00:02:48,050 --> 00:02:51,790
Let me just change the console and bring it up here so we can see the values.

42
00:02:51,950 --> 00:02:57,800
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

43
00:02:57,800 --> 00:02:58,950
are now at 2.

44
00:02:59,030 --> 00:03:01,260
And if we stop in there we go back to 1.

45
00:03:01,340 --> 00:03:08,300
So it starts from 0 and goes up what's now what I was telling you about about the lack of the constraints

46
00:03:08,300 --> 00:03:08,750
is.

47
00:03:08,780 --> 00:03:13,940
If I type something at the far right or the far left we don't get any interaction and that is because

48
00:03:14,300 --> 00:03:19,640
the size of our interactive view is actually is smaller than the size of these dots.

49
00:03:19,820 --> 00:03:27,710
Let me show you that visually go to a storyboard and select this guy I make it's got a more distinct

50
00:03:27,710 --> 00:03:32,170
color let's say a red color and we run the application again.

51
00:03:32,200 --> 00:03:35,240
You will see that the size of it actually stays like now.

52
00:03:35,260 --> 00:03:36,110
Avoid the dots.

53
00:03:36,110 --> 00:03:37,940
They go outside of it.

54
00:03:38,090 --> 00:03:45,170
So for that reason we can either say let's make this much larger so we know we are safe or properly

55
00:03:45,170 --> 00:03:46,540
set the constraints for it.

56
00:03:46,560 --> 00:03:52,990
I'm going to say it has a leading space constraint at trailing a space and a top a space and then maybe

57
00:03:52,990 --> 00:03:57,980
a changed all the values of the constraints to be zero.

58
00:03:58,130 --> 00:04:02,390
That is the trailing and leading to be zero on the top of it.

59
00:04:02,390 --> 00:04:04,430
I don't care if there is good.

60
00:04:04,430 --> 00:04:10,550
Now I'm going to select the page controller changes color back to the default and now we should be able

61
00:04:10,550 --> 00:04:13,030
to type it anywhere on this page control.

62
00:04:13,070 --> 00:04:15,240
I still see something happening.

63
00:04:15,590 --> 00:04:17,720
And that's exactly what they wanted to see.

64
00:04:17,750 --> 00:04:23,690
Everytime I type on it we get an instruction and every time they do that we get a number changing and

65
00:04:23,750 --> 00:04:26,870
we get one two three four or five and all the other numbers.

66
00:04:26,870 --> 00:04:32,780
And as you can imagine we should find this strategy for ourselves to connect these numbers to the pages

67
00:04:32,780 --> 00:04:34,390
of a scroll view.

68
00:04:34,400 --> 00:04:39,890
Now before I go out of this list and I this is just for a quick reminder of some of the things you have

69
00:04:39,890 --> 00:04:42,770
done in the past nobody really ever does this.

70
00:04:42,780 --> 00:04:46,680
They wanted to remind you of the transforms that we had going in the past.

71
00:04:46,910 --> 00:04:48,450
And for that I'm going to go in here.

72
00:04:48,450 --> 00:04:52,510
Select this guy and I'm going to say let's get rid of all the constraints.

73
00:04:52,550 --> 00:04:55,730
All these three I'm going to make it a little bit smaller.

74
00:04:55,730 --> 00:04:57,790
Maybe something like this.

75
00:04:57,820 --> 00:04:59,580
Misc zoom into here.

76
00:04:59,680 --> 00:05:07,770
Maybe something like that maybe a little bit smaller and I'm going to set the numbers in here so I have

77
00:05:07,770 --> 00:05:10,970
the number of pages six so I can see what's going on.

78
00:05:11,250 --> 00:05:13,400
And then I'm going to go to my view controller.

79
00:05:13,500 --> 00:05:17,920
And once again this is really something you would usually do but just for fun.

80
00:05:17,940 --> 00:05:19,940
And so that we can see things again.

81
00:05:20,070 --> 00:05:26,730
I'm going to see my page contorted that transformed becomes my page controller doth transform and I'm

82
00:05:26,730 --> 00:05:31,700
going to say scaley to boy mesoscale it two times in every direction.

83
00:05:31,800 --> 00:05:38,800
And if I run this now we should be able to see our controller twice as big unbosom width and height.

84
00:05:39,090 --> 00:05:45,010
And that's just you know for better visualization of it I can tap on it than ever and I can get the

85
00:05:45,210 --> 00:05:50,380
you know get the dots to move and we can see the different numbers appearing in here.

86
00:05:50,400 --> 00:05:53,950
So that's about that for using a page controller.

87
00:05:53,950 --> 00:05:55,620
And I will see you in the next lesson.
