-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path12. Autolayout.srt
5724 lines (4580 loc) · 131 KB
/
12. Autolayout.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,602
[MUSIC]
(音乐)
2
00:00:04,671 --> 00:00:07,338
Stanford University,
斯坦福大学,
3
00:00:07,407 --> 00:00:09,840
>> Welcome to Standford CS 193P,
> >欢迎来到斯坦福CS 193便士,
4
00:00:09,909 --> 00:00:13,977
Developing Applications for iOS, Winter of 2017,
iOS应用程序开发,2017年冬天,
5
00:00:14,046 --> 00:00:16,746
This is lecture number 12, and
这是12号的讲座,
6
00:00:16,815 --> 00:00:20,650
today our topic is going to be Autolayout,
今天我们的主题是自动布局,
7
00:00:20,718 --> 00:00:23,886
I'm going to review a little bit of what we already know
我将回顾一些我们已经知道的东西
8
00:00:23,955 --> 00:00:25,120
about Autolayout and
关于自动布局和
9
00:00:25,189 --> 00:00:28,057
then move onto a very important part of auto layout
然后移动到一个非常重要的部分自动布局
10
00:00:28,125 --> 00:00:31,727
called size classes then we'll demo everything as usual,
称为大小类然后我们将演示一切像往常一样,
11
00:00:33,330 --> 00:00:36,264
What have you seen in Autolayout already?
在自动布局已经你看过什么?
12
00:00:36,333 --> 00:00:38,565
Well, you know about the dash blue lines,
嗯,你知道dash蓝线,
13
00:00:38,634 --> 00:00:41,268
When you drag things out and move them around and
当你拖动和移动它们
14
00:00:41,337 --> 00:00:44,605
you make those dash blue lines appear you know that it helps
你让那些冲蓝线出现你知道它帮助
15
00:00:44,673 --> 00:00:47,874
Xcode when you wanna do Reset to Suggested Constraints,
Xcode重置为建议限制,当你想做的
16
00:00:47,943 --> 00:00:50,376
And you know that sometimes Reset to
你知道有时重置
17
00:00:50,445 --> 00:00:54,446
Suggested Constraints doesn't really do what you want,
建议限制并没有真正做你想做的事情,
18
00:00:54,515 --> 00:00:57,616
It really only works if those blue lines just unambiguously
真的只能如果这些蓝线明确
19
00:00:57,684 --> 00:00:58,483
obviously,
很明显,
20
00:00:58,552 --> 00:01:01,152
That's what you wanted,
这就是你想要的,
21
00:01:01,221 --> 00:01:04,055
But you also know that after you do something,
但是你也知道,在你做一些事情,
22
00:01:04,124 --> 00:01:06,490
especially after you do reset to suggest the constraints,
特别是在你重置为建议的约束,
23
00:01:06,559 --> 00:01:09,560
you can go over to the Size Inspector and
你可以去督察和大小
24
00:01:09,628 --> 00:01:14,565
click on any of the views in your UI and you
点击任何UI和你的意见
25
00:01:14,633 --> 00:01:17,433
can look at the constraints and it shows you them,
可以看看约束和它向您展示了他们,
26
00:01:17,502 --> 00:01:19,736
You can even kind of hover over them with the mouse and
你甚至可以用鼠标和上空盘旋
27
00:01:19,804 --> 00:01:21,970
they will show them on the screen,
他们将显示在屏幕上,
28
00:01:22,039 --> 00:01:23,038
Highlight them, etc,
强调他们,等,
29
00:01:23,107 --> 00:01:25,507
So that's a good tool to know what's going on,
所以这是一个很好的工具,知道发生了什么,
30
00:01:25,575 --> 00:01:27,408
You also know that you can click on the constraint
你也知道,你可以点击约束
31
00:01:27,477 --> 00:01:28,108
itself,
本身,
32
00:01:28,177 --> 00:01:29,877
The little I beams or whatever,
小我梁之类的,
33
00:01:29,945 --> 00:01:32,646
you can click on them and bring up inspector on them and
你可以点击,弹出检查员和
34
00:01:32,715 --> 00:01:37,651
you can see a lot of detail: what the constants are,
你可以看到很多细节:什么是常数,
35
00:01:37,719 --> 00:01:40,320
what's on either end of them, in other words what
在两端,换句话说什么
36
00:01:40,388 --> 00:01:42,188
the constraints, the two things being involved and
参与和约束,两件事
37
00:01:42,256 --> 00:01:44,724
constrained are, so you already know that as well,
限制,所以你已经知道,
38
00:01:46,127 --> 00:01:49,027
You also know about control dragging
你也知道控制拖
39
00:01:49,096 --> 00:01:52,097
to edges, we did a lot of control dragging to the edge
边,我们做了很多控制拖到边缘
40
00:01:52,165 --> 00:01:55,400
to make our UI kinda use up all the space but
使我们的UI但有点用完所有的空间
41
00:01:55,468 --> 00:01:58,502
you also saw a little bit of a hint in the smashtag demo
你也看到一点点的提示smashtag演示
42
00:01:58,571 --> 00:02:02,740
that you can actually control drag between any two views,
你可以控制阻力之间的任何两个观点,
43
00:02:02,809 --> 00:02:05,275
This is the key thing about Autolayout,
自动布局,这是关键的事情
44
00:02:05,344 --> 00:02:08,511
It sets constraints really between any two views,
真的集约束之间的任何两个观点,
45
00:02:08,580 --> 00:02:10,346
There's really almost no restriction
其实几乎没有限制
46
00:02:10,415 --> 00:02:12,748
between the things you can set constraints,
你可以设置约束之间的事情,
47
00:02:12,817 --> 00:02:15,651
Again so we'll see that in the demo a little bit today,
所以我们会看到,在今天的演示一下,
48
00:02:15,719 --> 00:02:19,387
Now in addition to control dragging to set up these
现在除了控制拖动设置
49
00:02:19,456 --> 00:02:22,724
constraints between things, you can also select them,
约束之间的事情,你也可以选择它们,
50
00:02:22,793 --> 00:02:24,992
I select one view or select a couple of views,
我选择一个视图或选择一些观点,
51
00:02:25,061 --> 00:02:27,495
And there's a couple little menus in the corner down
角落里,有几个小菜单
52
00:02:27,564 --> 00:02:30,230
there the pin menu or the align menu and
销菜单或菜单和对齐
53
00:02:30,299 --> 00:02:34,601
then this other kinda generic menu that has a lot of random
然后这其他通用的菜单,有很多随机的
54
00:02:34,669 --> 00:02:36,436
things you can set constraints for,
你可以设置约束,
55
00:02:36,505 --> 00:02:37,970
And we'll use that today as well, so
今天,我们将使用,所以
56
00:02:38,039 --> 00:02:40,673
you can see that different way of doing it,
你可以看到,不同的方法,
57
00:02:40,742 --> 00:02:42,508
Pretty much everything in there you can do with
几乎有你能做的一切
58
00:02:42,576 --> 00:02:45,410
Ctrl+drag, but sometimes it's hard to do Ctrl+drag,
Ctrl +拖,但有时很难做Ctrl +拖,
59
00:02:45,479 --> 00:02:47,245
Maybe the views are very close together, or
也许视图非常接近,或
60
00:02:47,314 --> 00:02:48,712
they're really near the edge,
他们真的在边缘附近,
61
00:02:48,781 --> 00:02:50,881
or they're overlapping some other view,
或者他们重叠的其他视图,
62
00:02:50,950 --> 00:02:53,884
And so when that starts to be a problem, you can
所以当开始成为一个问题,你可以
63
00:02:53,953 --> 00:02:56,786
click on them to select, either using the control shift
点击选择,要么使用控制转变
64
00:02:56,855 --> 00:02:59,255
click to drill down if things are overlapping, or
点击下钻如果重叠,或
65
00:02:59,324 --> 00:03:01,891
maybe use the document outline to select it, and then go to
也许使用文档大纲以选择它,然后去
66
00:03:01,959 --> 00:03:05,128
these menus to apply whatever constraints that you want,
这些菜单应用任何你想要的约束,
67
00:03:06,630 --> 00:03:09,564
Now the document outline, we've showed briefly and
现在文档大纲,我们显示简要和
68
00:03:09,633 --> 00:03:12,367
I'll show it again today, is really the go to place to
今天我将展示一遍,真的是去的地方
69
00:03:12,435 --> 00:03:14,368
resolve problems with constraints,
解决问题与约束,
70
00:03:14,437 --> 00:03:18,906
Both constraints that are insufficient, in other words
这两个约束不足,换句话说
71
00:03:18,975 --> 00:03:22,442
you, you haven't put enough constraints on a view for
你,你还没有把足够的限制一个视图
72
00:03:22,511 --> 00:03:25,945
the Xcode to or the IOS to know where the thing goes,
Xcode或IOS知道的事,
73
00:03:26,014 --> 00:03:27,781
Or constraints that conflict,
或约束冲突,
74
00:03:27,850 --> 00:03:30,216
Maybe you put two constraints on a views
也许你把两个限制的观点
75
00:03:30,284 --> 00:03:32,318
that is like they're pulling against each other and
就像他们对彼此和
76
00:03:32,387 --> 00:03:33,218
IOS doesn't know what to do,
IOS不知道要做什么,
77
00:03:33,287 --> 00:03:36,254
So the document outline is the place to go to resolve
所以文档大纲是去解决的地方
78
00:03:36,323 --> 00:03:39,624
all that stuff and we'll see that in the demo today,
所有这些,我们会看到,在今天的演示,
79
00:03:39,692 --> 00:03:42,793
Now one thing to understand about autolayout is it takes
现在有一件事要理解自动布局是需要的
80
00:03:42,862 --> 00:03:44,728
experience to master it,
经验来掌握它,
81
00:03:44,797 --> 00:03:47,364
There's a lot of degrees of freedom there with those
有很多与这些自由度
82
00:03:47,432 --> 00:03:49,733
constraints in terms of how you can
约束条件如何
83
00:03:49,802 --> 00:03:53,703
constrain views relative to each other and
相对于彼此,限制的观点
84
00:03:53,772 --> 00:03:55,905
there's just no substitute for experience,
只是不可替代的经验,
85
00:03:55,974 --> 00:03:57,540
You just have to do it,
你只需要这样做,
86
00:03:57,608 --> 00:04:01,243
So don't expect that after you see the demo today,
所以不要认为你今天看到的演示后,
87
00:04:01,312 --> 00:04:02,811
And after what you've seen earlier in the course,
之后,你见过的,
88
00:04:02,880 --> 00:04:05,213
Like, "now I am an auto layout master",
说,“现在我是一个自动布局大师”,
89
00:04:05,281 --> 00:04:08,182
You will have to be designing a lot of user interfaces,
你必须设计一个用户界面,
90
00:04:08,251 --> 00:04:09,617
Lining up a lot of edges,
排队的边缘,
91
00:04:09,686 --> 00:04:13,119
Making things the same widths, those kinds of things,
做相同的宽度,这样的事情,
92
00:04:13,188 --> 00:04:16,556
Until you learn kind of the tools enough to be a good
直到你学会一种足以是一个很好的工具
93
00:04:16,625 --> 00:04:17,423
auto layout master,
自动布局的主人,
94
00:04:17,492 --> 00:04:18,757
But once you master it,
但是一旦你掌握它,
95
00:04:18,826 --> 00:04:22,128
it can be really really super powerful as you can see,
它可以真的超级强大的正如你所看到的,
96
00:04:23,631 --> 00:04:26,331
Autolayout is also doable from code,
从代码自动布局也是可行的,
97
00:04:26,400 --> 00:04:27,832
In other words, there is a class and
换句话说,有一个类和
98
00:04:27,901 --> 00:04:29,968
it's layout constraint and
这是约束和布局
99
00:04:30,036 --> 00:04:34,205
it has all the functionality is in the story board,
它的所有功能在故事板,
100
00:04:34,273 --> 00:04:36,874
We rarely use it because we can do
我们很少使用它,因为我们可以做
101
00:04:36,943 --> 00:04:39,610
pretty much anything from a story board,
几乎任何一个故事板,
102
00:04:39,679 --> 00:04:42,111
But I'm not gonna have time to teach it,
但是我不会有时间教,
103
00:04:42,180 --> 00:04:44,180
Obviously I have to be selective about what
显然,我必须选择什么
104
00:04:44,249 --> 00:04:46,382
I can show you in this limited time available,
我可以带你在这有限的时间,
105
00:04:46,451 --> 00:04:49,151
But you can do some pretty tricky things in code that
但是你可以在代码做一些很棘手的事情
106
00:04:49,219 --> 00:04:53,354
you can't do in storyboard, but they're pretty, I don't
你不能在故事板,但是他们漂亮,我不喜欢
107
00:04:53,423 --> 00:04:56,925
want to say advanced, but they are, let's say fairly obscure,
想说先进,但是他们是,假设相当模糊,
108
00:04:56,993 --> 00:04:59,627
And so, if you're interested in pursuing that, maybe for
所以,如果你感兴趣,也许
109
00:04:59,695 --> 00:05:00,661
your final project, or
你最后的项目,或
110
00:05:00,730 --> 00:05:03,164
something, you can just start with NSLayout constraint in
一些东西,你可以从NSLayout约束
111
00:05:03,232 --> 00:05:10,504
the documentation, and kind of go from there,
文档,从那里开始,
112
00:05:13,274 --> 00:05:17,142
Let's talk a little about rotation, auto rotation,
让我们谈一下旋转,自动旋转,
113
00:05:17,211 --> 00:05:19,912
We know that when we rotate, that's one of the biggest
我们知道,当我们旋转,这是最大的一个
114
00:05:19,980 --> 00:05:22,515
times that autolayout has to kick in and figure out where
次自动布局和找出踢
115
00:05:22,583 --> 00:05:25,484
things go because things have dramatically changed,
去,因为事情已经发生了巨大的变化,
116
00:05:25,552 --> 00:05:28,953
They're much wider than they are tall now or vice versa,
他们是更广泛的比现在高,反之亦然,
117
00:05:29,022 --> 00:05:32,122
And sometimes unfortunately,
有时很不幸,
118
00:05:32,191 --> 00:05:37,661
that rotation causes such a dramatic change in your UI
旋转导致这样一个戏剧性的变化在你的UI
119
00:05:37,730 --> 00:05:41,265
that you want to actually move views around in a way that you
其实你想移动视图的方式
120
00:05:41,333 --> 00:05:45,669
just can't say by align these edges, make these the same
只是不能说通过对齐这些边缘,使这些相同的
121
00:05:45,737 --> 00:05:48,438
width, keep this separation, those kinds of things,
宽度,保持这种分离,这样的事情,
122
00:05:48,507 --> 00:05:51,140
You actually want to pick them up and move them,
你真的想拾起并移动它们,
123
00:05:51,208 --> 00:05:55,044
And actually, a great example of that is our calculator,
实际上,一个很好的例子,这是我们的计算器,
124
00:05:55,112 --> 00:05:58,880
Our calculator, at least, not your calculator but
我们的计算器,至少不是你的计算器
125
00:05:58,949 --> 00:06:02,183
the calculator we last saw in demo had 20 buttons, and
我们上次见到的计算器演示有20按钮、和
126
00:06:02,252 --> 00:06:06,287
we had it as four across and five down,
我们把它当作四,五,
127
00:06:06,356 --> 00:06:08,789
And that made a lot of sense because
做了很多有意义的,因为
128
00:06:08,858 --> 00:06:11,459
in portrait mode we had a lot of vertical space and
在竖屏模式,我们有很多的垂直空间
129
00:06:11,527 --> 00:06:14,327
not a lot of horizontal space, so we kinda went for the,
没有太多的水平空间,所以我们有点的,
130
00:06:14,396 --> 00:06:17,530
The five high, four wide,
五个高,宽四,
131
00:06:17,599 --> 00:06:20,033
But when we switch to landscape, now it's not so
但当我们切换到景观,现在不是这样的
132
00:06:20,102 --> 00:06:22,702
good, cuz all of the buttons are squished down,
好,因为所有的按钮都是扁平的,
133
00:06:22,771 --> 00:06:24,737
They're really wide and thin,
他们真的又宽又薄,
134
00:06:24,806 --> 00:06:27,105
It would be much better if when we get to landscape,
这将是更好的,如果当我们到达风景,
135
00:06:27,174 --> 00:06:28,740
we could go to five across and
5,我们可以去
136
00:06:28,809 --> 00:06:32,243
four down because we have a lot less space,
4因为我们有很多更少的空间,
137
00:06:32,312 --> 00:06:35,112
Now, can you imagine trying to do a control drag to
现在,你能想象试图控制阻力
138
00:06:35,181 --> 00:06:37,314
make that happen is basically impossible,
实现这个目标基本上是不可能的,
139
00:06:37,383 --> 00:06:38,515
It can't be done,
不能完成,
140
00:06:38,584 --> 00:06:41,985
But it's possible to do with a very important
但也有可能与一个非常重要的
141
00:06:42,054 --> 00:06:44,988
feature which I'm gonna talk about in a moment here,
功能,一会儿我要讲,
142
00:06:45,057 --> 00:06:49,425
Now, this kind of rotation stuff is,
现在,这种旋转的东西,
143
00:06:49,493 --> 00:06:52,328
the problem where your view changes from landscape
视图从景观变化的问题
144
00:06:52,397 --> 00:06:54,363
to portrait and you wanna move all the views around
肖像,你想移动的所有视图
145
00:06:54,432 --> 00:06:56,531
can happen in other situations too,
也可以发生在其他情况下,
146
00:06:56,600 --> 00:06:59,667
Imagine that you have an MVC that wants to look good in
假设您有一个MVC,想看起来不错
147
00:06:59,736 --> 00:07:02,570
Landscape, but also wants to look good when it's the master
景观,还想看起来不错的主
148
00:07:02,639 --> 00:07:04,572
of a Split View Controller,
分屏视图控制器,
149
00:07:04,640 --> 00:07:06,574
The master of a Split View Controller kind of looks likes
的主人看起来喜欢拆分视图控制器
150
00:07:06,642 --> 00:07:09,242
it's in portrait, so even though you're on an iPad,
肖像,所以即使你在iPad上,
151
00:07:09,311 --> 00:07:11,745
let's say, sometimes you have tall and
比方说,有时你高大
152
00:07:11,813 --> 00:07:14,180
skinny, just like what you have on an iPhone,
瘦,就像你在iPhone上,
153
00:07:14,249 --> 00:07:19,518
So it's not just iPhone issue only or rotation issue only,
所以这不仅仅是iPhone只或旋转问题问题,
154
00:07:19,587 --> 00:07:23,255
So, the solution to all this is called size classes,
因此,所有这叫做大小类的解决方案,
155
00:07:23,324 --> 00:07:25,791
Now, Apple has chosen to take an approach to dealing with
现在,苹果公司选择一个方法来处理
156
00:07:25,860 --> 00:07:27,692
this which is fairly simple,
这是相当简单的,
157
00:07:27,761 --> 00:07:30,895
Which is a pretty good idea because you could imagine
这是一个不错的主意,因为你可以想象吗
158
00:07:30,964 --> 00:07:34,632
a very complicated solution that tries to, basically, take
一个非常复杂的解决方案,试图,基本上,
159
00:07:34,700 --> 00:07:37,935
into effect every possible geometry and every size,
每一个可能的几何和每一个尺寸,
160
00:07:38,004 --> 00:07:40,570
You could end up writing a lot of code or a massive number
你可能会写很多代码或者一个巨大的数字
161
00:07:40,639 --> 00:07:43,139
of auto layout constraints to make it work,
自动布局的限制使它工作,
162
00:07:43,208 --> 00:07:46,709
So they've boiled it down to this very simple system
所以他们煮这个非常简单的系统
163
00:07:46,778 --> 00:07:50,012
where they talk about size classes and a view or
他们讨论类和视图或大小
164
00:07:50,081 --> 00:07:53,249
a view controller at any given time exists with
一个视图控制器存在在任何给定的时间
165
00:07:53,317 --> 00:07:54,716
a certain size class,
一定规模类,
166
00:07:54,785 --> 00:07:56,384
Both in the horizontal direction and
在水平方向上和
167
00:07:56,453 --> 00:07:57,551
the vertical direction,
垂直方向,
168
00:07:57,620 --> 00:08:00,988
And the only two values that the size class can have is
唯一的类可以有两个值的大小
169
00:08:01,057 --> 00:08:03,490
compact or regular,
或普通紧凑,
170
00:08:03,559 --> 00:08:06,026
So regular is regular sized, and
所以常规是常规尺寸,
171
00:08:06,094 --> 00:08:09,696
compact means that you're constrained in that direction,
简洁意味着你在这个方向约束,
172
00:08:11,933 --> 00:08:13,733
Let's look at all our devices and
让我们看看我们所有的设备和
173
00:08:13,802 --> 00:08:17,803
see when they're constrained in either compact
看到当他们限制在紧凑
174
00:08:17,871 --> 00:08:21,373
in either height or width, and when they're just regular,
在高度或宽度,当他们只是普通的,
175
00:08:21,442 --> 00:08:25,944
Let's talk about the iPhone first the iPhone in portraits
首先让我们来谈谈iPhone肖像的iPhone
176
00:08:26,012 --> 00:08:29,714
is regular in height, plenty of height, but
身高一般、足够的高度,但
177
00:08:29,782 --> 00:08:31,215
it's compact in width,
紧凑的宽度,
178
00:08:31,284 --> 00:08:34,118
It's kinda constrained in width in that circumstance,
在这种情况下,有点宽限制
179
00:08:34,186 --> 00:08:38,255
When you switch to landscape, maybe surprisingly,
当你切换到景观,也许令人惊讶的是,
180
00:08:38,324 --> 00:08:42,859
iPhones are compact in both directions because even though
iphone在两个方向,因为即使紧凑
181
00:08:42,928 --> 00:08:45,561
when you go to landscape, it gets quite a bit wider,
当你去风景,它变得相当宽,
182
00:08:45,630 --> 00:08:47,329
it's still not that wide,
它还不宽,
183
00:08:47,398 --> 00:08:48,764
Okay, it's not wide like an iPad,
好吧,这不是宽像iPad一样,
184
00:08:50,768 --> 00:08:52,033
It's still somewhat constrained, so
还是有些限制,所以
185
00:08:52,101 --> 00:08:54,969
they've decided to make landscape
他们已经决定格局
186
00:08:55,038 --> 00:08:57,037
iPhone be compact in both directions,
iPhone是在两个方向上紧凑,
187
00:08:57,106 --> 00:09:00,173
So in portrait it's regular in height and compact in width,
所以在肖像定期在宽度、高度和紧凑
188
00:09:00,242 --> 00:09:02,609
But in Landscape, it's compacted both directions,
但在景观,压实两个方向,
189
00:09:02,678 --> 00:09:04,043
We will encounter into it but
我们会遇到,但是
190
00:09:04,112 --> 00:09:06,278
just see it works out quite nicely,
看看它的工作原理很好地,
191
00:09:06,347 --> 00:09:08,313
Now, the iPhone +s, the 6+ and
现在,iPhone +年代,6 +和
192
00:09:08,382 --> 00:09:10,882
the 7+, those are a little different,
这是有点不同的,7 +
193
00:09:10,951 --> 00:09:13,918
They're still compact in width,
他们仍然紧凑的宽度,
194
00:09:13,987 --> 00:09:15,820
And regular in height in portrait but
和定期在肖像但高度
195
00:09:15,889 --> 00:09:17,288
when you go to landscape,
当你去风景,
196
00:09:17,357 --> 00:09:19,823
since those iPhone pluses are so
因为这些iPhone有利
197
00:09:19,892 --> 00:09:22,993
big, that they can actually start showing that kind of
大,他们可以开始出现的
198
00:09:23,062 --> 00:09:26,696
horizontal UI just like it was an iPad or something,
水平的UI就像iPad之类的,
199
00:09:26,765 --> 00:09:31,734
So they are regular in width in landscape mode,
所以他们定期在横向模式宽度,
200
00:09:31,803 --> 00:09:33,502
iPhone is compact in both,
iPhone是在紧凑,