@@ -16,87 +16,108 @@ welcome to Lecture number 7, Stanford CS193P, Fall 2017. So
16164
171700:00:14,080 --> 00:00:19,351
1818our primary topic today is combining MVCs to make bigger,
19+ 今天,我们的主要任务显然就是将多个 MVC 组合成组件更多,
1920
20215
212200:00:19,420 --> 00:00:22,153
2223more powerful applications, obviously. And
24+ 功能更强大的应用程序。
2325
24266
252700:00:22,222 --> 00:00:24,890
2628then I'm gonna do a big demo that shows you how to do that.
29+ 同时,我也将示范编写一个更大的样例程序来向你们展示该如何完成这项工作。
2730
28317
293200:00:24,959 --> 00:00:27,559
3033We're gonna do it with Concentration, we're gonna add
34+ 本次的示范将以 Concentration 这个 app 为基础,我们将来要向其添加
3135
32368
333700:00:27,627 --> 00:00:30,929
3438an MVC into that app. Then I'll come back to the slides,
39+ 一个 MVC。然后我会回到幻灯片上,
3540
36419
374200:00:30,998 --> 00:00:33,865
3843and talk I'll about timer and choose classes, some of you
44+ (这里疑似all about)我会讲授有关计时器和选择类的相关内容,
3945
404610
414700:00:33,934 --> 00:00:37,169
4248used in the extra credit of the homework assignments. And
49+ 这部分内容你们可能会在作业的选做部分需要用到。
4350
445111
455200:00:37,237 --> 00:00:39,004
4653then I'm gonna dive into the next topic and try and
54+ 然后的时间我会尽可能深入讲解下一个主题,也就是动画部分,
4755
485612
495700:00:39,073 --> 00:00:41,373
5058get as far as I can which is animation.
59+ 能讲多少讲多少。
5160
526113
536200:00:41,442 --> 00:00:43,275
5463Which will be our topic on Wednesday and
64+ 这也将是我们在周三的课程上的主要内容,
5565
566614
576700:00:43,343 --> 00:00:45,376
5868I'll get to much more detail, do a big demo.
69+ 并且我会更深入地讲解更多细节性内容,做一个更大的示范程序。
5970
607115
617200:00:45,445 --> 00:00:47,512
6273But I wanna kinda get in as far as I can today just so
74+ 我今天会尽可能地讲解理论部分的内容,
6375
647616
657700:00:47,581 --> 00:00:50,916
6678we have more time for a demo on Wednesday.
79+ 这样我们周三上课时就会有足够的时间进行操作示范。
6780
688117
698200:00:50,984 --> 00:00:54,486
7083Alright so combining MVCs, remember this slide from when
84+ 回到整合 MVC 上来,还记得我们讲解 MVC 时使用的这张幻灯片吗?
7185
728618
738700:00:54,555 --> 00:00:58,190
7488I talked about MVC. This is the MVCs working together, and
89+ 这就是多个 MVCs 协同工作的示意图,
7590
769119
779200:00:58,259 --> 00:01:01,193
7893we saw that when we have MVCs working together,
94+ 我们可以看到,当多个 MVCs 协同工作时,
7995
809620
819700:01:01,261 --> 00:01:04,862
8298these other MVCs. Let me get my thing under control here,
99+ 其他的 MVC……(此处幻灯片动画出错)让我把它修好……
83100
8410121
8510200:01:04,931 --> 00:01:08,967
86103well, can't do it. Okay, these other MVCs down in the corner,
104+ 好吧,它彻底坏掉了。其他的角落里的 MVCs
87105
8810622
8910700:01:09,036 --> 00:01:12,170
90108they serve as part of the view of another MVC. That's
109+ 他们通过控制其他 MVC 中的一个 view,来为整个 app 服务。
91110
9211123
9311200:01:12,239 --> 00:01:16,608
94113the way MVC's relate. An MVC is a view, part of a view
114+ 这就是 MVC 之间相互联系的方法。一个 MVC 就是一个 view,同时也是其他类中的 view 的一部分。
95115
9611624
9711700:01:16,677 --> 00:01:19,811
98118of another class. And that has some ramifications for MVC,
99119
120+
10012125
10112200:01:19,880 --> 00:01:22,781
102123most notably it has to have blind structured communication
@@ -1141,65 +1162,81 @@ which is often nice to have a title of your master of
1141116200:14:10,183 --> 00:14:13,517
11421163your split view. Now you can- One thing to notice about this
11431164
1165+
11441166286
1145116700:14:13,586 --> 00:14:16,420
11461168of course, is that now the master of your split view is
1169+ 现在你的 Split View 的主视图控制器不再是 Calculator 了,
11471170
11481171287
1149117200:14:16,489 --> 00:14:19,757
11501173no longer the calculator, it's a navigationController.
1174+ 而是一个 navigationController。
11511175
11521176288
1153117700:14:19,826 --> 00:14:21,492
11541178So if you actually wanted to get out the calculator,
1179+ 如果你确实想要获取到 calculator,
11551180
11561181289
1157118200:14:21,561 --> 00:14:23,394
11581183you would have to get the master and
1184+ 你必须先获取到主视图控制器,
11591185
11601186290
1161118700:14:23,463 --> 00:14:27,465
11621188then look at the master's rootViewController to find
1189+ 然后找到它的 rootViewController,
11631190
11641191291
1165119200:14:27,533 --> 00:14:29,901
11661193the calculator there.
1194+ 你要找的 calculator 在那里。
11671195
11681196292
1169119700:14:29,969 --> 00:14:32,469
11701198By the way, you can also put the detail, wrap it in
1199+ 另外,你也可以把你的细节视图控制器放在一个 navigationController 中
11711200
11721201293
1173120200:14:32,538 --> 00:14:34,839
11741203a navigationController. The only reason you would ever
1204+ 你想做这件事,唯一的原因就是
11751205
11761206294
1177120700:14:34,908 --> 00:14:37,908
11781208want to do that is to give it a title bar, cuz you don't,
1209+ 想给它一个标题栏。
11791210
11801211295
1181121200:14:37,977 --> 00:14:40,445
11821213you always navigate from the master, that's why it's called
1214+ 你总是从主视图控制器导入的,这也是他被称为“主”的原因。
11831215
11841216296
1185121700:14:40,513 --> 00:14:43,313
11861218the master. So you can do it, but again if you do that,
1219+ 所以你可以这么做,不过再一次,如果你这么做的话
11871220
11881221297
1189122200:14:43,382 --> 00:14:45,716
11901223make sure when you look at the detail, if you find that
1224+ 确保当你关注 detail 的时候,
11911225
11921226298
1193122700:14:45,784 --> 00:14:48,652
11941228it's a navigationController, you need to look inside and
1229+ 如果你发现他是一个 navigationController,你就需要向里看,
11951230
11961231299
1197123200:14:48,721 --> 00:14:51,488
11981233see the thing that's inside of it, the rootViewController.
1234+ 找到它内部的视图控制器,rootViewController。
11991235
12001236300
1201123700:14:51,557 --> 00:14:53,223
12021238Or you can also use visibleViewController
1239+ 或者你也可以用 visibleViewController
12031240
12041241301
1205124200:14:53,292 --> 00:14:54,392
0 commit comments