-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy path16. More Segues.srt
executable file
·5525 lines (4146 loc) · 117 KB
/
16. More Segues.srt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1
00:00:00,401 --> 00:00:04,702
本字幕由志愿者义务贡献,采用许可协议
知识共享 署名-非商业性使用-相同方式共享 3.0 美国
2
00:00:04,771 --> 00:00:09,841
Stanford University. >> Welcome to lecture number
>> 斯坦福大学 >> 好,欢迎来到斯坦福
3
00:00:09,910 --> 00:00:14,413
16 of Stanford CS193P, fall of 2017 18.
CS193P 2017-18 年秋季学期的第十六节课
4
00:00:14,481 --> 00:00:16,548
We have one topic today but it's a big one,
5
00:00:16,617 --> 00:00:18,883
lots of different parts of it which is segues.
6
00:00:18,952 --> 00:00:21,487
This is the last important thing you need to know
7
00:00:21,555 --> 00:00:24,323
structurally to be able to build complicated apps.
8
00:00:24,391 --> 00:00:26,524
So we're gonna dive right into the first one here,
9
00:00:26,593 --> 00:00:29,661
which is modal Segues. You actually already know about
10
00:00:29,729 --> 00:00:32,631
Modal View Controllers because in our emoji Art view and
11
00:00:32,700 --> 00:00:36,134
in your homework, you actually presented your document view
12
00:00:36,203 --> 00:00:41,306
modally. So a Modal View Controller is one that takes
13
00:00:41,375 --> 00:00:44,008
over the whole screen, usually it slides up from the bottom,
14
00:00:44,077 --> 00:00:47,111
though not always. And here I have an example of
15
00:00:47,180 --> 00:00:51,016
some sort of contact keeping app and it's got little +
16
00:00:51,085 --> 00:00:53,852
button in the upper right and when I press that it modesty
17
00:00:53,920 --> 00:00:57,422
segues to or modally presents another view controller so
18
00:00:57,491 --> 00:01:00,492
a completely different view controller. This is
19
00:01:00,561 --> 00:01:03,195
not a navigation controller, there's no back button instead
20
00:01:03,264 --> 00:01:05,563
you can see there's a Cancel button there. And
21
00:01:05,632 --> 00:01:08,399
I can have presented this view controller and then present
22
00:01:08,468 --> 00:01:10,735
another view controller if I want. For example,
23
00:01:10,804 --> 00:01:13,972
this little add photo button in this new contact MVC,
24
00:01:14,041 --> 00:01:16,975
if you press it, it presents another modal view controller
25
00:01:17,044 --> 00:01:18,510
on top of the other one.
26
00:01:18,579 --> 00:01:21,212
Again, no back button, this is not a navigation controller.
27
00:01:21,281 --> 00:01:23,415
We are just presenting these thing modally.
28
00:01:23,484 --> 00:01:27,085
We call it modally because the app is now in a mode,
29
00:01:27,154 --> 00:01:32,724
essentially, where it can only do this MVC. So we get out of
30
00:01:32,793 --> 00:01:35,327
this, of course, by having to dismiss these view controllers
31
00:01:35,395 --> 00:01:37,795
just like we did with our document and Emoji Art.
32
00:01:37,864 --> 00:01:41,599
So I'm gonna Cancel this one, goes back to the previous one.
33
00:01:41,668 --> 00:01:45,137
I Cancel this one, it's gonna go back to its previous one,
34
00:01:45,206 --> 00:01:47,706
and we're back to where we started here.
35
00:01:47,774 --> 00:01:49,674
So that's it modal view controller's very simple.
36
00:01:49,743 --> 00:01:52,110
Now, I wait to tell you about modal view controllers
37
00:01:52,179 --> 00:01:54,379
until really the end of the quarter,
38
00:01:54,448 --> 00:01:57,382
because this is really not the primary way you wanna be
39
00:01:57,451 --> 00:02:00,986
putting view controllers up. Navigation controllers and
40
00:02:01,054 --> 00:02:04,423
split view controllers are a much better way to interact
41
00:02:04,491 --> 00:02:07,058
with the user, it's because of this mode business.
42
00:02:07,127 --> 00:02:09,193
You don't really wanna put your users in a situation
43
00:02:09,262 --> 00:02:11,129
where they can only do what you're telling them to do.
44
00:02:11,198 --> 00:02:13,165
They like the flexibility to navigate around,
45
00:02:13,234 --> 00:02:15,433
change their mind, go somewhere else. And
46
00:02:15,502 --> 00:02:17,402
they can't do that if you put them in this mode,
47
00:02:17,471 --> 00:02:21,039
all they can do is cancel it to get back to that world. So
48
00:02:21,108 --> 00:02:24,909
I generally recommend thinking of another way to put an MVC
49
00:02:24,978 --> 00:02:29,715
up first before you resort to modal. So how do we set
50
00:02:29,783 --> 00:02:33,085
a modal segue? Exactly the same as all our other segues,
51
00:02:33,153 --> 00:02:36,187
we just control drag. Of course we can present it
52
00:02:36,256 --> 00:02:39,090
from code as well with perform segue with identifier.
53
00:02:39,159 --> 00:02:41,493
And we even learned, in last lecture,
54
00:02:41,562 --> 00:02:45,029
there how to present a view controller, not with a segue,
55
00:02:45,098 --> 00:02:47,932
in a modal fashion, which is the present method
56
00:02:48,001 --> 00:02:51,970
in view controller. That's how we got our Emoji Art document
57
00:02:52,038 --> 00:02:55,173
onscreen when it was chosen, and so you know all of that.
58
00:02:55,242 --> 00:02:59,177
But modal segues and modal presentations kind of like
59
00:02:59,245 --> 00:03:02,781
the basic segue. It's again I'm only telling you at last
60
00:03:02,849 --> 00:03:05,850
because you don't wanna use it as your first resort. But
61
00:03:05,919 --> 00:03:08,387
there's nothing simpler when it comes to this kinda thing,
62
00:03:08,455 --> 00:03:11,523
and so preparing for a modal segue is, again,
63
00:03:11,591 --> 00:03:15,494
exactly what you're used to, nothing special whatsoever.
64
00:03:15,562 --> 00:03:18,797
And one interesting thing about modal is how do I
65
00:03:18,866 --> 00:03:23,468
hear back from a modal segue to MVC?
66
00:03:23,537 --> 00:03:27,071
I put that contacts thing, I added a contact, how do I get
67
00:03:27,140 --> 00:03:31,910
the contact that I wanna add back, to my contacts app. And
68
00:03:31,979 --> 00:03:35,113
really, things fall into two categories there for the most
69
00:03:35,182 --> 00:03:38,483
part. One is you don't need to give anything back, so
70
00:03:38,551 --> 00:03:41,953
like in the contacts app maybe that new contacts MVC just
71
00:03:42,022 --> 00:03:45,590
puts it in a database and then you just dismiss that thing.
72
00:03:45,659 --> 00:03:48,093
And when you came back to the other one it's just gonna be
73
00:03:48,162 --> 00:03:50,328
showing it because it's watching the database.
74
00:03:50,397 --> 00:03:53,632
In other words they're sharing a model for example. But there
75
00:03:53,700 --> 00:03:55,600
is the case where you actually have to communicate back.
76
00:03:55,669 --> 00:03:58,870
So let's say we didn't have that sort of design in our add
77
00:03:58,939 --> 00:03:59,838
contact thing,
78
00:03:59,907 --> 00:04:02,507
actually it wants to give us our contact back.
79
00:04:02,576 --> 00:04:06,011
In that sense you wanna think about those modally presented
80
00:04:06,079 --> 00:04:08,980
view controllers like the add contacts MVC as part
81
00:04:09,049 --> 00:04:12,183
of the view of the previous one. Just like in a navigation
82
00:04:12,252 --> 00:04:14,986
tool when we go to the next card on the stack, we think of
83
00:04:15,055 --> 00:04:17,722
that as a part of our view. Kinda why I think of the same
84
00:04:17,791 --> 00:04:21,993
thing here, so, that thing you present can't really talk back
85
00:04:22,062 --> 00:04:25,730
to the thing that presented it. Really the thing that
86
00:04:25,799 --> 00:04:28,900
presented it needs to talk to it. And we have a mechanism
87
00:04:28,969 --> 00:04:31,169
for doing that, it's called unwind segue,
88
00:04:31,238 --> 00:04:34,205
which I'm gonna talk about at the end of today's lecture.
89
00:04:34,274 --> 00:04:39,377
And that's really how we would communicate things back and
90
00:04:39,445 --> 00:04:44,282
still keep MVC intact there. And how do we dismiss a view
91
00:04:44,351 --> 00:04:46,884
controller? Again, you've already learned this because
92
00:04:46,953 --> 00:04:49,053
we dismissed our document view controller.
93
00:04:49,122 --> 00:04:52,123
Use this method dismiss but I kinda mislead you in our demo
94
00:04:52,192 --> 00:04:54,793
last time, and I'm gonna straighten that out and
95
00:04:54,861 --> 00:04:57,729
I kinda did it intentionally so that you would see these
96
00:04:57,797 --> 00:04:59,664
change that I'm gonna make today.
97
00:04:59,733 --> 00:05:03,401
And realize I see, and what I mislead you about is that it
98
00:05:03,470 --> 00:05:07,505
is really the presenting view controller's responsibility to
99
00:05:07,574 --> 00:05:11,309
dismiss not the presented. And you notice that in our
100
00:05:11,378 --> 00:05:15,680
Emoji Art app we had our close button just say dismiss,
101
00:05:15,748 --> 00:05:18,216
in other words it's saying dismiss to the Emoji Art
102
00:05:18,284 --> 00:05:21,019
document saying dismiss yourself.
103
00:05:21,087 --> 00:05:23,989
That's really not the right way to do that,
104
00:05:24,057 --> 00:05:26,924
now it works because the dismiss method will
105
00:05:26,993 --> 00:05:30,361
automatically forward that to its presenting view
106
00:05:30,430 --> 00:05:33,999
controller, if you've been presented. But the reason we
107
00:05:34,067 --> 00:05:36,567
don't like to rely on that's probably in there for
108
00:05:36,636 --> 00:05:39,671
some sort of historic reason. But the reason we don't wanna
109
00:05:39,740 --> 00:05:42,874
rely on it is because if we had the line dismiss inside of
110
00:05:42,942 --> 00:05:46,311
our code somewhere in a view controller, it usually means
111
00:05:46,380 --> 00:05:49,247
we're going to dismiss something we presented,
112
00:05:49,316 --> 00:05:53,117
cuz we're the presenting view controller. So to make that
113
00:05:53,186 --> 00:05:56,288
clear, when we're dismissing ourself, we probably wanna
114
00:05:56,356 --> 00:05:58,724
send that to our presenting view controller.
115
00:05:58,792 --> 00:06:00,591
And there's a var in UIViewController called
116
00:06:00,660 --> 00:06:02,493
presentingViewController. That,
117
00:06:02,562 --> 00:06:04,563
if you've been presented, it will not be nil and
118
00:06:04,631 --> 00:06:07,065
you can send it dismiss, and that will dismiss yourself.
119
00:06:07,133 --> 00:06:10,535
So we're gonna go back to our demo today, and I'm gonna
120
00:06:10,604 --> 00:06:14,339
change our call to dismiss to say presentingViewController
121
00:06:14,408 --> 00:06:18,176
optional chain .dismiss. Just to make it clear that really
122
00:06:18,245 --> 00:06:19,844
we should be asking our present,
123
00:06:19,913 --> 00:06:22,948
it's not necessarily wrong to dismiss ourselves like that,
124
00:06:23,016 --> 00:06:26,417
but it's confusing. Because we're not sure whether that
125
00:06:26,486 --> 00:06:29,520
dismiss means to dismiss something I presented or
126
00:06:29,589 --> 00:06:33,124
dismiss myself, so we're just trying to clear that up.
127
00:06:33,193 --> 00:06:36,228
Yeah, so like I say for convenience it's forwarded but
128
00:06:36,296 --> 00:06:38,630
we don't rely on it. Now another thing of course is
129
00:06:38,699 --> 00:06:42,000
this Unwind Segue I alluded to where you gotta communicate
130
00:06:42,068 --> 00:06:44,936
information back that automatically dismisses. So
131
00:06:45,004 --> 00:06:48,239
that's another way to dismiss, and we'll see that when we
132
00:06:48,308 --> 00:06:51,643
talk about unwind towards the end here. You can also control
133
00:06:51,711 --> 00:06:54,846
the presentation of the view controller a little bit with
134
00:06:54,914 --> 00:06:58,516
the modal presentation style var in view controller. And
135
00:06:58,584 --> 00:07:01,986
this only can have a little bit of control, for example,
136
00:07:02,055 --> 00:07:04,055
the default is .fullScreen, the
137
00:07:04,124 --> 00:07:06,691
modelPresentationStyle.fullSc- reen.
138
00:07:06,760 --> 00:07:08,426
That means slide up from the bottom and
139
00:07:08,494 --> 00:07:10,562
cover the whole screen, that's what you've been seeing so
140
00:07:10,631 --> 00:07:13,998
far, that's the default. There's also overFullScreen
141
00:07:14,067 --> 00:07:16,734
which is interesting, that does the same thing except
142
00:07:16,803 --> 00:07:19,270
for it lets the view controller that's covering
143
00:07:19,339 --> 00:07:22,206
up shine through. So that if you're presenting a view
144
00:07:22,275 --> 00:07:25,142
control that has a clear background it'll show through.
145
00:07:25,211 --> 00:07:27,045
Now we don't usually do that, so
146
00:07:27,114 --> 00:07:29,714
hide something with a clear background. However, sometimes
147
00:07:29,783 --> 00:07:32,917
we will slide something out with a blurred background. And
148
00:07:32,986 --> 00:07:35,019
I'm not gonna really talk about visual effects,
149
00:07:35,088 --> 00:07:38,056
look at UI visual effects if you wanna learn more about it.
150
00:07:38,124 --> 00:07:39,224
But you can make it so
151
00:07:39,292 --> 00:07:41,760
that you have a nice blurred background, and
152
00:07:41,828 --> 00:07:46,764
that would be the time we'd use overFullScreen. On iPad,
153
00:07:46,833 --> 00:07:50,968
sometimes doing the full screen approach is just too
154
00:07:51,037 --> 00:07:55,340
much white space, the screen is so big there's way too much
155
00:07:55,408 --> 00:07:58,810
white space. So there's a couple of ways to have an iPad
156
00:07:58,878 --> 00:08:03,014
a little smaller area come up and have your.
157
00:08:03,083 --> 00:08:06,084
View Controller, and the one is called pageSheet which
158
00:08:06,152 --> 00:08:08,386
kinda does something the size of a piece of paper.
159
00:08:08,455 --> 00:08:10,821
It looks to be a piece of paper. And then form sheet,
160
00:08:10,890 --> 00:08:13,591
which is even a smaller little white thing. And,
161
00:08:13,660 --> 00:08:18,563
when these things show up, the rest of the UI is grayed out.
162
00:08:18,632 --> 00:08:21,132
It's kind of grayed out and also completely inaccessible.
163
00:08:21,200 --> 00:08:22,601
You can't touch it on, you can't interact with it,
164
00:08:22,669 --> 00:08:26,971
whatever. In horizontally compact environment like
165
00:08:27,040 --> 00:08:31,609
iPhone, Right or iPhone plus in portrait,
166
00:08:31,678 --> 00:08:35,413
the iOS will automatically adapt form sheet and
167
00:08:35,482 --> 00:08:38,015
page sheet styles to be full screen because
168
00:08:38,084 --> 00:08:41,419
there's just not enough room to show a form sheet or a page
169
00:08:41,488 --> 00:08:43,988
sheet on an iPhone and still have the gray area around.
170
00:08:44,057 --> 00:08:45,723
Everything would be jammed too small.
171
00:08:45,792 --> 00:08:48,827
So it'll automatically adapt for you.
172
00:08:48,895 --> 00:08:52,297
How about the animation of the thing appearing on screen.
173
00:08:52,366 --> 00:08:54,599
Well, by default it slides up from the bottom,
174
00:08:54,667 --> 00:08:56,801
that's called cover vertical, but
175
00:08:56,870 --> 00:08:59,103
it also has flipped horizontal where you can flip it over.
176
00:08:59,172 --> 00:09:02,773
Another one is cross-dissolve, and, finally, there's partial
177
00:09:02,842 --> 00:09:05,644
curl which looks like a piece of paper flipping up off
178
00:09:05,712 --> 00:09:08,613
the bottom, which in kinda cool that one only works
179
00:09:08,682 --> 00:09:12,683
with fullscreen modal, doesn't work with the page sheet or
180
00:09:12,752 --> 00:09:14,619
form sheet. Doesn't make sense you can't really fold it
181
00:09:14,688 --> 00:09:17,822
up from the bottom when you're kinda got the excess
182
00:09:17,891 --> 00:09:22,293
area around the edges. So we don't really tend to use those
183
00:09:22,361 --> 00:09:27,165
other ones that much, you know you want to be careful UI
184
00:09:27,234 --> 00:09:31,069
be too tricky. You want it to feel like other UIs. We tend
185
00:09:31,137 --> 00:09:33,537
to leave that one cover vertical most of the time.
186
00:09:33,606 --> 00:09:35,473
Both of these styles, the presentation style and
187
00:09:35,541 --> 00:09:38,276
the transition style can be set in the story board.
188
00:09:38,345 --> 00:09:41,612
You just inspect the segue you created by control dragging
189
00:09:41,681 --> 00:09:44,949
and in Inspector there you can set these things. All right,
190
00:09:45,017 --> 00:09:46,284
so, we're going to do a demo here.
191
00:09:46,353 --> 00:09:47,718
We're going to go back to EmojiArt.
192
00:09:47,787 --> 00:09:51,089
And what we're going to do is add an inspector.
193
00:09:51,157 --> 00:09:52,991
You know how you have an inspector in XCode.
194
00:09:53,059 --> 00:09:55,693
Well, we're going to have an inspector of EmojiArt
195
00:09:55,762 --> 00:09:57,929
documents and what it's going to tell us about the EmojiArt
196
00:09:57,998 --> 00:10:02,434
documents is the size in bytes and when it was created. So
197
00:10:02,502 --> 00:10:05,270
it's a simple inspector. This is a demo after all.
198
00:10:05,338 --> 00:10:07,605
I'll probably throw the thumbnail image in,
199
00:10:07,673 --> 00:10:09,540
into the inspector as well. Just so I can show you
200
00:10:09,609 --> 00:10:12,543
a little bit what we can do with constraints in code,
201
00:10:12,612 --> 00:10:15,412
because I have a little more to show you about constraints.
202
00:10:15,481 --> 00:10:20,418
So let's hop on over here. Here is EmojiArt exactly as
203
00:10:20,487 --> 00:10:23,988
we left it last time. This is our EmojiArt document
204
00:10:24,057 --> 00:10:26,457
view controller here, EmojiArtViewControl And
205
00:10:26,526 --> 00:10:28,759
what I'm gonna do is I'm gonna a little button right here.
206
00:10:28,828 --> 00:10:31,963
I'm gonna call it inspect I guess. And
207
00:10:32,032 --> 00:10:32,697
when you click this button,
208
00:10:32,765 --> 00:10:36,634
it's gonna bring a whole new view controller up modally.
209
00:10:36,702 --> 00:10:40,304
That inspects this document that we're looking at.
210
00:10:40,373 --> 00:10:43,140
So let's go ahead and create that new view controller.
211
00:10:43,209 --> 00:10:46,777
And just to review, we created a new view controller just by
212
00:10:46,846 --> 00:10:48,412
dragging it out. So
213
00:10:48,481 --> 00:10:50,281
here I put a new view controller in here.
214
00:10:50,350 --> 00:10:52,817
Of course every view controller needs it's own
215
00:10:52,885 --> 00:10:55,486
view controller sub class, to controller. So I'm gonna go
216
00:10:55,555 --> 00:10:59,590
new file here, we're creating a coco touch class, it's
217
00:10:59,659 --> 00:11:03,394
a sub class of UIV controller. I'm gonna call it my document
218
00:11:03,463 --> 00:11:06,998
info view controller, all right. Put it in the same
219
00:11:07,066 --> 00:11:09,834
place we out all our other files there. Here it is.
220
00:11:09,903 --> 00:11:12,503
I'm gonna make sure that I don't forget to go back here
221
00:11:12,572 --> 00:11:16,240
and inspect with the identity inspector up here and
222
00:11:16,309 --> 00:11:18,743
change it to be a document info view Controller
223
00:11:18,811 --> 00:11:21,445
otherwise won't be able to wire up my outlets and
224
00:11:21,514 --> 00:11:25,216
actions and all that business. Let's go ahead and
225
00:11:25,284 --> 00:11:28,853
add this info button that modally segues to that.
226
00:11:28,921 --> 00:11:32,089
Search for button here. Of course, I'm going to use a bar
227
00:11:32,158 --> 00:11:35,026
button item because I'm putting it in my bar up here.
228
00:11:35,095 --> 00:11:39,030
I don't think there's any predefined button type for
229
00:11:39,098 --> 00:11:41,566
inspector info, so I'm going to use a custom button this
230
00:11:41,635 --> 00:11:46,604
time. The title, I'm going to have it be Inspect. And
231
00:11:46,672 --> 00:11:48,138
then I'm just gonna control drag,
232
00:11:48,207 --> 00:11:50,774
this is how you create a modal segue, just control drag, and,
233
00:11:50,843 --> 00:11:52,744
instead of picking Show or Show Detail,
234
00:11:52,812 --> 00:11:55,213
which is navigation controller in split view controller,
235
00:11:55,281 --> 00:11:57,348
we're gonna do present modally. And
236
00:11:57,417 --> 00:12:00,050
that creates this little segue right here, we can look at it.
237
00:12:00,119 --> 00:12:03,588
Of course, we're gonna wanna prepare this MVC so
238
00:12:03,657 --> 00:12:05,023
we will need an identifier.
239
00:12:05,091 --> 00:12:09,027
I'm gonna call this segue under identifier Show Document
240
00:12:09,095 --> 00:12:11,628
info cuz that's what it does right there and you can see
241
00:12:11,697 --> 00:12:14,199
this presents Modally. Here's where I was talking about you
242
00:12:14,267 --> 00:12:17,868
can change how it presents Page Sheet, Form Sheet.
243
00:12:17,937 --> 00:12:19,937
And also how it animates on screen,
244
00:12:20,006 --> 00:12:24,041
right. I'm just inspecting this little guy right here.
245
00:12:24,110 --> 00:12:26,110
So now I need to build my UI here for
246
00:12:26,179 --> 00:12:30,681
my document. Info, so I'm gonna have some labels here,
247
00:12:30,750 --> 00:12:32,650
of course, for the size and the creation date.
248
00:12:32,719 --> 00:12:35,586
So I'm gonna bring that out, actually I'm gonna create four
249
00:12:35,655 --> 00:12:40,724
of these, four labels, and zoom in so
250