1
00:00:00,490 --> 00:00:01,040
Playing.

2
00:00:01,110 --> 00:00:07,420
Sometimes when you work on specifically larger applications it makes sense that you break your storyboards

3
00:00:07,470 --> 00:00:09,540
into several different fights.

4
00:00:09,550 --> 00:00:14,930
Let's letting your application has 10 different views and every view has some you know supporting UI

5
00:00:14,940 --> 00:00:16,250
views and whatnot.

6
00:00:16,260 --> 00:00:21,110
And for that it really is no better if you actually have more than one storyboard.

7
00:00:21,210 --> 00:00:27,030
And if you have that you have to learn how to segway between not just the viewer contours of the same

8
00:00:27,120 --> 00:00:31,280
storyboard but rather the view controllers of multiple storyboards.

9
00:00:31,320 --> 00:00:32,910
I'm going to show you two different ways.

10
00:00:32,910 --> 00:00:38,690
One of them is purely based on their interface and the other one is with some programmatic approaches

11
00:00:38,700 --> 00:00:39,090
as well.

12
00:00:39,510 --> 00:00:40,960
So let's have a look at both of them.

13
00:00:41,130 --> 00:00:51,180
And when I go to court and when I start a new application called segway to a storyboard UI in the user

14
00:00:51,180 --> 00:00:55,120
interface not with programming.

15
00:00:55,330 --> 00:01:01,240
So here I'm going to go to my storyboard and then when I assume that I have one button and this button

16
00:01:01,240 --> 00:01:06,790
is supposed to take us to another storyboard and victim there another view controller.

17
00:01:07,150 --> 00:01:15,220
So my button says go to next and it has a different background such as this one.

18
00:01:15,280 --> 00:01:21,970
Now I need another a storyboard file so to do that I'm going to say fine you fine and yet I'm going

19
00:01:21,970 --> 00:01:23,230
to choose a storyboard.

20
00:01:23,240 --> 00:01:25,150
I'm gonna say this is next.

21
00:01:25,240 --> 00:01:31,700
And I'm actually going to call it Next a storyboard so next dot a storyboard.

22
00:01:31,990 --> 00:01:37,990
So now this is a story that doesn't have anything in it but what they do need is a view controller.

23
00:01:38,020 --> 00:01:43,540
So we have a view controller in my newer storyboard and maybe this view controller has the same green

24
00:01:43,540 --> 00:01:43,990
color.

25
00:01:44,530 --> 00:01:51,460
And this is now supposed to be my green view control of when I go to of course just just like any other

26
00:01:51,460 --> 00:01:55,460
Storyboard You can have your view controller classes are added in here.

27
00:01:55,510 --> 00:02:03,510
You can for instance have a cockroach touch classless call it green view controller and in your next

28
00:02:03,530 --> 00:02:05,180
you can just connected there.

29
00:02:05,330 --> 00:02:09,060
Just like if you had it in any other a storyboard essentially.

30
00:02:09,440 --> 00:02:14,930
Once I have my view controller in the other a storyboard taking care of I'm going to head back to my

31
00:02:14,930 --> 00:02:20,390
main storyboard and in a year I need a V to go from here to the previous a story.

32
00:02:20,450 --> 00:02:26,060
So to do that I'm going to go up here and I'm going to add a different object that is called a storyboard

33
00:02:26,060 --> 00:02:32,740
reference and that's essentially a way to providing a place holder for a view controller in an external

34
00:02:32,760 --> 00:02:33,750
storyboard.

35
00:02:33,770 --> 00:02:37,910
So I'm going to add that and that's a reference to another storyboard.

36
00:02:37,970 --> 00:02:43,340
So for that I'm going to go in here in the attributes and say this is truly what I want to get the reference

37
00:02:43,340 --> 00:02:50,820
to is actually next and then it's telling me so Veatch referenced I.D. do you want to use which of you

38
00:02:50,820 --> 00:02:56,240
controller is the idea for the view controller do you want to go to and that's something I haven't set

39
00:02:56,250 --> 00:02:56,610
yet.

40
00:02:56,610 --> 00:03:03,900
So and then go to my next storyboard the game select my view controller and say this view controller

41
00:03:04,020 --> 00:03:06,510
actually has an a storyboard idea.

42
00:03:06,750 --> 00:03:13,230
So let me come in here zoom into this area and say this view contour has an a storyboard idea that is

43
00:03:13,230 --> 00:03:17,050
called Green the V.C. idea.

44
00:03:17,160 --> 00:03:26,940
So I'm going to copy that name go to my main storyboard again select my reference and say from next

45
00:03:27,120 --> 00:03:35,120
I want to get to this one go up green V.S. idea and then everything is as usual I could just select

46
00:03:35,120 --> 00:03:41,370
the green by then all the control and draw and you say Great say present more daily.

47
00:03:41,380 --> 00:03:46,830
The reason I'm doing Woodley and not show is because I don't have a navigation controller the Mercy

48
00:03:46,870 --> 00:03:53,250
present modelling and maybe my model I'm going to change the transition type I'm going to say to the

49
00:03:53,250 --> 00:03:54,570
Flip horizontal.

50
00:03:55,230 --> 00:04:02,460
And now everything is set for an application to essentially make a transition between one a storyboard

51
00:04:02,670 --> 00:04:08,050
to another storyboard using a Segway to the reference a storyboard.

52
00:04:08,190 --> 00:04:14,520
If I press on the green now we essentially get navigated to the storyboard of the other fight.

53
00:04:15,420 --> 00:04:21,630
And from this point on we're essentially here we we're within the next storyboard and we can do whatever

54
00:04:21,630 --> 00:04:23,030
we wanted to doing here.

55
00:04:23,070 --> 00:04:30,030
Keep in mind that when you did the reference in the main a storyboard here if I actually cut this for

56
00:04:30,030 --> 00:04:36,070
a second it says what is the initial view controller of the either a storyboard.

57
00:04:36,090 --> 00:04:40,800
So that's the initial one that we land in there and then you can do whatever you want to do from that

58
00:04:40,800 --> 00:04:41,280
point on.

59
00:04:41,880 --> 00:04:43,920
So that was one way of doing it.

60
00:04:43,920 --> 00:04:47,190
That is essentially doing everything in the interface builder.

61
00:04:47,190 --> 00:04:50,340
Now I'm going to show you another way of doing the same thing with this thing.

62
00:04:50,340 --> 00:04:56,230
We're going to do it entirely programmatically so I'm going to start a new application that's called

63
00:04:56,250 --> 00:05:07,700
this one the Segway to another storyboard programmatic it's a long name for an application by the state.

64
00:05:07,990 --> 00:05:09,640
So I have my main a storyboard.

65
00:05:09,650 --> 00:05:13,730
It has a white bank on it and hopefully a button soon.

66
00:05:13,760 --> 00:05:17,430
I have a newer storyboard Fire Command and a storyboard.

67
00:05:17,450 --> 00:05:18,820
This is called the next.

68
00:05:18,830 --> 00:05:25,370
Just like the last time between my next I have a view controller this viewpoint or I'm going to make

69
00:05:25,370 --> 00:05:33,840
it look green perhaps so we can actually see it more distinctly that screen and the very same process

70
00:05:33,840 --> 00:05:35,080
that we did last time.

71
00:05:35,100 --> 00:05:39,980
In terms of setting titles and ideas we have to do it in here as well.

72
00:05:39,990 --> 00:05:45,120
So once again I'm going to stick my dream view controller coin here and say a storyboard a different

73
00:05:45,150 --> 00:05:52,560
is green view controller I.D. I'm going to copy that name and then I'm gonna go to I mean a storyboard

74
00:05:52,650 --> 00:05:54,000
and have a button.

75
00:05:54,150 --> 00:05:57,590
I'm gonna say that by then is placed in here.

76
00:05:58,910 --> 00:06:05,570
I actually let it have some constraint so it doesn't look as ugly as usual of 400 there.

77
00:06:05,910 --> 00:06:07,210
Not have it.

78
00:06:07,260 --> 00:06:09,110
No but 20.

79
00:06:09,710 --> 00:06:10,590
Okay.

80
00:06:10,650 --> 00:06:13,510
And then my then is going to have a bank gone.

81
00:06:13,530 --> 00:06:19,160
That is also green and says Go to Green.

82
00:06:19,330 --> 00:06:22,160
And of course I have to add a function for this by then.

83
00:06:22,170 --> 00:06:27,360
So I'm going to load up my assistant window and in my system even though I'm going to say I don't need

84
00:06:27,360 --> 00:06:39,210
the view that load but they do need is an action and that action is saying go to Green Action Now.

85
00:06:39,390 --> 00:06:43,870
Everything that we have to actually do programmatically happens within here.

86
00:06:44,100 --> 00:06:49,830
And this is actually kind of important because from time to time you end up using this system as opposed

87
00:06:49,830 --> 00:06:52,530
to doing everything in the interface builder.

88
00:06:52,980 --> 00:06:57,340
So the first thing they have to do is I have to get access to my next storyboard.

89
00:06:57,540 --> 00:07:06,840
So I'm going to say let's next storyboard that's going to become UI a storyboard and I'm going to make

90
00:07:06,840 --> 00:07:11,040
it using a name within a bundle for the bundle they have a name.

91
00:07:11,040 --> 00:07:17,100
So it refers to the current bundle and the name of it is obviously next because that's the name we gave

92
00:07:17,100 --> 00:07:18,390
to our storyboard.

93
00:07:18,840 --> 00:07:24,750
So now we have our storyboard taking care of the next thing we need is we need to find our view controllers.

94
00:07:25,050 --> 00:07:28,470
So I'm going to say let's next to view controller.

95
00:07:28,560 --> 00:07:29,000
That's true.

96
00:07:29,030 --> 00:07:37,530
Coming next the storyboard died instantiate the view controller with identifiers and identifier for

97
00:07:37,530 --> 00:07:38,770
it was green.

98
00:07:38,810 --> 00:07:40,290
V.S. Aida.

99
00:07:40,620 --> 00:07:43,720
So I'm essentially saying let me format this better.

100
00:07:44,010 --> 00:07:52,770
I'm saying get the next view controller find the view controller that has the idea during VCAT and place

101
00:07:52,770 --> 00:07:55,820
it in next see and once they have that.

102
00:07:55,930 --> 00:07:57,570
That's very simple from this point on.

103
00:07:57,600 --> 00:08:05,520
I can simply say self present view controller or if I wanted to I could actually use a navigation controller

104
00:08:05,550 --> 00:08:07,470
which is what I wanted doing here.

105
00:08:07,470 --> 00:08:13,260
So let's change a little thing as well so let's go ahead to remain a storyboard and say we also have

106
00:08:13,290 --> 00:08:17,400
a navigation controller and that's a good reminder of how we do that.

107
00:08:17,400 --> 00:08:25,590
So Ed embed in a navigation controller so by default or vite view controller or main view controller

108
00:08:26,070 --> 00:08:28,470
is it within a navigation controller.

109
00:08:28,920 --> 00:08:35,730
And this is how we essentially go to a navigation controllers upcoming view controllers.

110
00:08:35,730 --> 00:08:43,840
I'm gonna say self navigation controller DOD push your controller on what am I pushing.

111
00:08:43,860 --> 00:08:46,820
Next we see is it animated.

112
00:08:46,830 --> 00:08:48,200
Of course it is.

113
00:08:48,310 --> 00:08:55,170
And now if I run the application is essentially gonna go find this storyboard find the view controller

114
00:08:55,520 --> 00:08:59,690
I'm pushed an aggregation controller into that view controller.

115
00:09:00,240 --> 00:09:02,840
Let's see if that is what I am suggesting.

116
00:09:02,940 --> 00:09:04,930
I had to go to Green I'm perfect.

117
00:09:04,950 --> 00:09:11,480
If we end up in here using a navigation controller essentially format.

118
00:09:11,640 --> 00:09:19,080
Once again I press that we end up in the green of the next storyboard not even within our own storyboard.

119
00:09:19,100 --> 00:09:25,650
And I've had that by then and the end up within the region of a story or a very handy solution for a

120
00:09:25,650 --> 00:09:32,760
lot of situations where we end up designing or up in multiple storyboards and that's very useful when

121
00:09:32,760 --> 00:09:36,890
you're working with a team of people or if your application is just very very large.

122
00:09:37,380 --> 00:09:40,720
So let's keep all of this in mind and move on to our next lesson.
