-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9. Table View.srt
10754 lines (8604 loc) · 243 KB
/
9. Table View.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,435
[MUSIC]
(音乐)
2
00:00:04,504 --> 00:00:07,605
Stanford University,
斯坦福大学,
3
00:00:07,674 --> 00:00:11,109
>> All right, well, welcome to Stanford CS193P,
> >好吧,好吧,欢迎来到斯坦福CS193P,
4
00:00:11,178 --> 00:00:14,946
Developing Applications for iOS, winter of 2017,
iOS应用程序开发,2017年冬天,
5
00:00:15,015 --> 00:00:18,183
This is Lecture number 9,
这是第九讲
6
00:00:18,252 --> 00:00:20,786
And today we have only one topic which is Table View,
今天我们只有一个主题表视图,
7
00:00:20,854 --> 00:00:23,187
And I'm gonna go through a bunch of slides to talk about
我要穿过一群幻灯片来谈论
8
00:00:23,256 --> 00:00:23,989
the concepts of it,
它的概念,
9
00:00:24,058 --> 00:00:26,992
And then we're gonna have a humongous demo
然后我们会有一个巨大无比的演示
10
00:00:27,061 --> 00:00:29,360
that we're gonna build a Twitter client and
我们要建立一个Twitter客户端
11
00:00:29,429 --> 00:00:31,296
it's gonna use Table View and
它会使用表格视图和
12
00:00:31,365 --> 00:00:33,532
some other things that we've learned, like Text Field,
其他一些我们学过的东西,像文本字段,
13
00:00:34,802 --> 00:00:36,835
And Table View, what is it?
和表视图,它是什么?
14
00:00:36,903 --> 00:00:40,739
You've seen a Table View in all sorts of iOS apps,
你见过各种各样的iOS应用程序表视图,
15
00:00:40,807 --> 00:00:43,908
It's just this UI where there's a list of things,
只是这个UI的事情的列表,
16
00:00:43,977 --> 00:00:46,879
There's really two different kinds of looks to Table View,
有两种不同的表视图看起来,
17
00:00:46,947 --> 00:00:48,479
There's the kind on the left there,
有左边的那种,
18
00:00:48,548 --> 00:00:50,648
which we call plain style,
我们称之为朴素的风格,
19
00:00:50,717 --> 00:00:53,818
Plain style is just a list of things,
普通样式只是事情的列表,
20
00:00:53,887 --> 00:00:56,721
And it might be collected into groups like little sections,
和它可能收集到团体像小部分,
21
00:00:56,790 --> 00:00:59,291
But it's mostly just a big long list,
但它主要只是一大长串,
22
00:00:59,359 --> 00:01:02,660
On the right side, is called a grouped style,
在右边,称为分组的风格,
23
00:01:02,729 --> 00:01:05,230
Where the sections in the table,
表中的部分,
24
00:01:05,299 --> 00:01:08,934
you're more obviously disconnected from each other,
你更明显的断开,
25
00:01:09,003 --> 00:01:11,436
They have you know, big gaps in between,
你知道,在之间的巨大差距,
26
00:01:11,505 --> 00:01:17,943
Normally the plain style we use for dynamic data,
通常我们使用的普通样式动态数据,
27
00:01:18,011 --> 00:01:20,445
Data that might have any number of items in there,
数据可能有任意数量的物品,
28
00:01:20,514 --> 00:01:22,580
The group style we tend to use for static data,
该组织风格我们倾向于使用静态数据,
29
00:01:22,649 --> 00:01:25,050
where we know exactly what rows are gonna be in there,
我们要知道行,
30
00:01:25,119 --> 00:01:28,120
and exactly what's gonna be in them,
和什么会,
31
00:01:28,188 --> 00:01:31,289
So let's talk about the names of all the parts of
让我们谈论所有的部分的名称
32
00:01:31,358 --> 00:01:33,558
a Table View, so that as I'm explaining all this,
表视图,这样当我解释这一切,
33
00:01:33,627 --> 00:01:35,461
you'll know what the terminology is,
你会知道的术语是什么,
34
00:01:36,563 --> 00:01:38,230
First we have a table header,
首先,我们有一个表标题,
35
00:01:38,298 --> 00:01:39,363
That's a UIView,
这是一个UIView,
36
00:01:39,432 --> 00:01:40,999
There's only one of them,
只有一个,
37
00:01:41,068 --> 00:01:43,135
It sits at the very top of the table,
坐在桌子的最顶端,
38
00:01:43,204 --> 00:01:44,902
This is where, as you'll see in the demo,
在这里,您将看到在演示,
39
00:01:44,971 --> 00:01:49,040
you might put a search field or something that searches
你可能会把搜索字段或搜索的东西
40
00:01:49,109 --> 00:01:51,009
to find what's in your table or something like that,
找到什么表之类的,
41
00:01:51,078 --> 00:01:53,478
And similarly, there's a footer view,
同样的,有一个页脚视图,
42
00:01:53,546 --> 00:01:54,513
Rarely see this used,
很少看到这个,
43
00:01:54,582 --> 00:01:57,749
But it's just a UIView that sits at the bottom
但它只是一个UIView位于底部
44
00:01:57,817 --> 00:01:59,301
And in between, there are these things called sections,
之间,都有这些东西称为部分,
45
00:01:59,302 --> 00:02:00,786
of the table,
的表,
46
00:02:00,854 --> 00:02:03,989
So a section is just a combination of a header and
所以只是一个标题和部分
47
00:02:04,058 --> 00:02:05,857
a footer, which are usually strings, but
一个页脚,通常是字符串,但是
48
00:02:05,925 --> 00:02:09,460
also could be UIViews, and then any number of rows,
也可能是ui视图,然后任意数量的行,
49
00:02:09,529 --> 00:02:10,728
That's what we call a section,
这就是我们所说的部分,
50
00:02:10,797 --> 00:02:12,397
So that's a section right there,
这是一个部分,
51
00:02:12,466 --> 00:02:15,667
This is the section header for the two sections that I have
这是一节头的两个部分
52
00:02:15,736 --> 00:02:18,537
showing in this table, right, where it says Header 0,
这个表显示,对吧,说头0,
53
00:02:18,605 --> 00:02:20,705
And these are sections footers for
这些是部分的页脚
54
00:02:20,774 --> 00:02:22,440
the two sections that I have,
我有两个部分,
55
00:02:22,509 --> 00:02:25,310
These two sections happen to both have the same numbers of
这两个部分都有相同数量的发生
56
00:02:25,379 --> 00:02:28,113
rows in each which is two but a section, one section have
行每一个都是两个,但部分,一个部分
57
00:02:28,182 --> 00:02:31,583
a 100 rows, and one could have just 1, it's perfectly fine,
一个100行,可能只有1,非常好,
58
00:02:32,786 --> 00:02:36,521
This right in here, we call a table cell,
在这里,我们调用一个表格单元,
59
00:02:36,589 --> 00:02:39,023
C-E-L-L, cell, and it's the UIView,
C-E-L-L、细胞和UIView,
60
00:02:39,092 --> 00:02:40,692
actually UITableViewCell,
实际上UITableViewCell,
61
00:02:40,761 --> 00:02:43,495
it's the name of the subclass that's in there,
的是子类的名称,
62
00:02:43,564 --> 00:02:46,731
And this is the thing that's gonna draw the data that's at
这是要画出的数据的
63
00:02:46,800 --> 00:02:47,799
a particular row,
一个特定的行,
64
00:02:47,868 --> 00:02:49,467
And we're gonna see how that works,
我们将看到这是如何工作的,
65
00:02:49,536 --> 00:02:52,203
By the way, along the bottom you're seeing source code that
顺便说一下,你看到底部的源代码
66
00:02:52,272 --> 00:02:54,005
kind of corresponds with these things,
符合这些东西,
67
00:02:54,074 --> 00:02:57,075
Don't worry I'm gonna get back to showing you all that stuff
别担心我会回到显示你所有的东西
68
00:02:57,143 --> 00:02:57,976
in later slides,
在后面的幻灯片,
69
00:02:58,045 --> 00:03:01,145
So this is the naming we use to name all the parts of
这是我们使用的命名的名字所有的部分
70
00:03:01,214 --> 00:03:03,014
a table view,
一个表格视图,
71
00:03:03,083 --> 00:03:04,148
And this is in plain style,
这是在朴素的风格,
72
00:03:04,217 --> 00:03:06,618
All the same names work in group style,
所有相同的名称在集团工作风格,
73
00:03:06,687 --> 00:03:08,519
Everything just kinda looks a little different,
一切都只是看起来有点不同,
74
00:03:08,588 --> 00:03:10,088
All right, still have a header, footer,
好吧,还有一个页眉,页脚,
75
00:03:10,157 --> 00:03:12,123
sections, all the same,
部分,都是一样的,
76
00:03:12,192 --> 00:03:14,059
Just a little different UI look,
只是有点不同的UI看,
77
00:03:15,896 --> 00:03:18,930
Now, tables can have sections or not,
现在,表可以有部分,
78
00:03:18,999 --> 00:03:20,832
You don't have to have any sections, so
你不需要有任何部分,
79
00:03:20,900 --> 00:03:25,003
the table on the left is just a whole list of cities and
左边的表是一个整体的城市和列表
80
00:03:25,071 --> 00:03:27,205
the countries they're in and just a big long list,
他们的国家在一大长串,
81
00:03:27,273 --> 00:03:29,307
On the right is kind of the same kind of list but
右边是同样的列表
82
00:03:29,376 --> 00:03:31,943
you can see that they're grouped into sections there by
你可以看到,他们被分成部分
83
00:03:32,011 --> 00:03:32,811
country, right,
的国家,
84
00:03:32,880 --> 00:03:35,213
So Japan there, Mexico, etc,
所以日本、墨西哥等
85
00:03:35,282 --> 00:03:37,248
So sections are optional,
所以部分是可选的,
86
00:03:37,317 --> 00:03:40,318
not optional in the case of an option, but
不是可选的一个选项,但是
87
00:03:40,387 --> 00:03:44,856
sections you can have them or not, it's totally up to you,
部分你可以与否,完全取决于你的喜好,
88
00:03:46,160 --> 00:03:51,096
The type of the cell, like each row, there are four
细胞的类型,像每一行,有四个
89
00:03:51,164 --> 00:03:54,432
kinda pre-defined types and then there's a custom type,
有点预定义的类型,然后有一个自定义的类型,
90
00:03:54,501 --> 00:03:57,969
The four pre-defined types are subtitle where you just got
这四个预定义类型是字幕你刚刚的地方
91
00:03:58,037 --> 00:03:58,737
like a title and
像一个标题和
92
00:03:58,806 --> 00:04:01,773
a little smaller text subtitle under it,
小文本字幕下它,
93
00:04:01,842 --> 00:04:03,575
There's default which is the same except
有违约,除非是一样的
94
00:04:03,643 --> 00:04:05,644
there's no little subtitle thing,
没有字幕的事情,
95
00:04:05,712 --> 00:04:08,179
There's value 1 and value 2, which is just like subtitle,
值1,值2,正如副标题,
96
00:04:08,248 --> 00:04:10,715
it's just that the little thing underneath is in
只是下面的小东西
97
00:04:10,784 --> 00:04:13,218
a different spot, it's either blue and
不同的地方,要么是蓝色的和
98
00:04:13,287 --> 00:04:17,588
to the left or it's kind of grayed off into the right but
到左边或者有点灰色的到正确的
99
00:04:17,657 --> 00:04:21,326
i's just how i's laying out the basic information there,
我就是我的布局的基本信息,
100
00:04:21,395 --> 00:04:23,995
Now a custom cell can have arbitrary UI
现在一个定制的细胞可以有任意的UI
101
00:04:24,063 --> 00:04:25,130
in it as you will see,
正如您将看到的,
102
00:04:26,533 --> 00:04:30,234
So how do we use a table view?
那么,我们如何使用表格视图?
103
00:04:30,303 --> 00:04:32,070
Okay, a table view is a UIView,
好的,UIView表视图,
104
00:04:32,139 --> 00:04:35,073
i's actually subclass UIScrollView because i's
我因为是子类
105
00:04:35,141 --> 00:04:38,176
scrolling through all those rows,
通过所有这些行滚动,
106
00:04:38,245 --> 00:04:40,495
Well 99% of the time, we use the special ViewController
99%的时间,我们使用特殊ViewController
107
00:04:40,496 --> 00:04:42,746
So how do we do it?
那么我们怎么做呢?
108
00:04:42,816 --> 00:04:45,884
called UITableViewController in UIKit,
叫UITableViewController UIKit,
109
00:04:45,952 --> 00:04:50,922
And UITableViewController is just a convenient package to
和UITableViewController只是一个方便的包装
110
00:04:50,991 --> 00:04:56,261
use UITableView in and its self,view is a UITableView,
使用UITableView及其自我,视图是一个UITableView,
111
00:04:56,330 --> 00:04:59,063
Okay, so you would only use a UITableViewController
好的,那么你只会使用UITableViewController
112
00:04:59,132 --> 00:05:02,066
when your entire self,view is going to be filled
当你的整个自我,视图将会填满
113
00:05:02,135 --> 00:05:04,035
with a table view,
表视图,
114
00:05:04,104 --> 00:05:06,771
And you can add one into your storyboard just by dragging it
你可以添加一个到你的故事板通过拖动它
115
00:05:06,840 --> 00:05:08,139
out as we always do,
我们总是一样,
116
00:05:08,208 --> 00:05:09,841
There's a thing called Table View Controller and
有一种东西叫做表格视图控制器
117
00:05:09,910 --> 00:05:10,675
it's just gonna drag it out,
它只是要拖出来,
118
00:05:10,744 --> 00:05:12,878
Now it's a controller, so when you drag it out,
现在这是一个控制器,所以当你拖出来,
119
00:05:12,946 --> 00:05:14,512
it looks like an MVC,
它看起来像MVC,
120
00:05:14,581 --> 00:05:16,314
But inside of that MVC,
但在MVC,
121
00:05:16,383 --> 00:05:18,316
there is a table view sitting there, okay?
有一个表格视图坐在那里,好吗?
122
00:05:18,385 --> 00:05:20,986
And so what you see here the controller,
所以你在这里看到的控制器,
123
00:05:21,055 --> 00:05:22,420
is a UITableViewController,
是一个UITableViewController,
124
00:05:22,489 --> 00:05:26,191
and the self,view of it is a UITableView,
和自我的观点UITableView,
125
00:05:26,260 --> 00:05:27,793
Okay, subclass of UIScrollView,
好的,UIScrollView的子类,
126
00:05:29,329 --> 00:05:31,662
Now like any other ViewController,
现在像其他ViewController一样,
127
00:05:31,731 --> 00:05:33,498
if you're going to do anything with this thing,
如果你要用这个东西,做任何事
128
00:05:33,567 --> 00:05:35,400
you need to subclass it, right?
你需要子类,对吧?
129
00:05:35,469 --> 00:05:37,302
Just like you create a calculator view controller or
就像你视图控制器或者创建一个计算器
130
00:05:37,370 --> 00:05:38,169
graph view controller,
图视图控制器,
131
00:05:38,237 --> 00:05:41,540
you need to subclass, your UITableViewController as well,
你需要子类,UITableViewController,
132
00:05:41,608 --> 00:05:43,074
And you do it the same way, right?
和你一样,对吧?
133
00:05:43,142 --> 00:05:44,910
New files are created,
创建新文件,
134
00:05:44,978 --> 00:05:48,146
It's gonna be a Cocoa Touch Class of course,
它会触控类当然,
135
00:05:48,214 --> 00:05:50,548
It's gonna be a subclass of UITableViewController,
它会UITableViewController的子类,
136
00:05:50,617 --> 00:05:51,549
Make sure you pick that,
确保你选择,
137
00:05:51,618 --> 00:05:53,585
Don't say it's a subclass of UIViewController,
不要说这是ui的一个子类,
138
00:05:53,654 --> 00:05:56,955
It has to be a subclass UITableViewController if you
它必须是一个子类UITableViewController如果你
139
00:05:57,023 --> 00:05:59,090
want it to work,
想要的工作,
140
00:05:59,158 --> 00:06:02,660
And then you just set it in the identity inspector
然后把它的身份检查
141
00:06:02,729 --> 00:06:03,995
Just exactly like any other controllers, just that it has
就像任何其他控制器,它
142
00:06:03,996 --> 00:06:05,262
to be your class,
您的课,
143
00:06:05,332 --> 00:06:08,033
to be subclass UITableViewController,
UITableViewController子类,
144
00:06:08,101 --> 00:06:11,002
This UITableViewController subclass
这UITableViewController子类
145
00:06:11,070 --> 00:06:14,739
is also going to serve as the data source and delegates,
也将作为数据源和代表,
146
00:06:14,808 --> 00:06:16,707
Okay, the data source is just a special kind of delegate for
好的,数据源是一种特殊的委托
147
00:06:16,776 --> 00:06:19,010
getting the data in the table,
表中的数据,
148
00:06:19,079 --> 00:06:21,045
For the table view that's inside of it,
里面的表视图,
149
00:06:21,114 --> 00:06:23,114
So, we're gonna talk a lot more about that
所以,我们要更多的谈论
150
00:06:23,183 --> 00:06:24,449
down the road here,
在路上,
151
00:06:24,517 --> 00:06:27,352
By the way, if you right click on the view controller and
顺便说一下,如果你右键单击视图控制器
152
00:06:27,421 --> 00:06:29,888
you get that black window to come up, you can actually see
黑色窗口出现,你可以看到
153
00:06:29,957 --> 00:06:31,623
it, if you look down towards the bottom there,
如果你向下看向底部,
154
00:06:31,691 --> 00:06:33,225
you see data source and delegate,
数据源和委托,
155
00:06:33,293 --> 00:06:35,560
Their properties and they're pre wired up for you,
属性和他们之前的连接给你,
156
00:06:35,628 --> 00:06:37,862
If you use this UITableViewController thing,
如果你使用这个UITableViewController的事情,
157
00:06:37,930 --> 00:06:39,431
just pre-wires it up,
pre-wires它,
158
00:06:39,500 --> 00:06:41,399
That the controller is the delegate and
控制器是委托
159
00:06:41,468 --> 00:06:44,335
data source of the table view,
数据源的表视图,
160
00:06:44,404 --> 00:06:46,304
If you don't use UITableViewController,
如果你不使用UITableViewController,
161
00:06:46,373 --> 00:06:48,373
by the way, this kinda pre-packaged one?
顺便说一下,这有点预包装的吗?
162
00:06:48,442 --> 00:06:50,375
Then you'll have to wire up the data source and
然后你将不得不数据源和连接
163
00:06:50,443 --> 00:06:52,811
delegate, you know, either in code by saying
委托,你知道,在代码中说
164
00:06:54,147 --> 00:06:57,215
tableView,delegate = self or something like that,
表视图,委托=自我之类的,
165
00:06:57,283 --> 00:06:59,150
You'll have to do it yourself but 99% of the time you're
你必须自己动手,但你99%的时间
166
00:06:59,219 --> 00:07:00,685
just gonna use this UITableViewController,
要使用这个UITableViewController,
167
00:07:00,754 --> 00:07:02,921
Cuz usually the best UI for a table view, is for
因为通常最好的表视图,UI
168
00:07:02,989 --> 00:07:05,156
it to take over the whole screen,
它接管整个屏幕,
169
00:07:05,225 --> 00:07:07,025
For it to fill the whole screen, it's rare that you can
填满整个屏幕,很少
170
00:07:07,094 --> 00:07:08,560
have a table view in part of your screen,
有一个表格视图在屏幕的一部分,
171
00:07:11,497 --> 00:07:14,866
So you can edit the attributes of the table view itself,
所以你可以编辑表格视图本身的属性,
172
00:07:14,935 --> 00:07:16,734
of course, by just clicking on it and
当然,只需点击它
173
00:07:16,803 --> 00:07:18,670
bringing up the attributes inspector,
将属性检查器,
174
00:07:18,738 --> 00:07:21,172
One thing that's a little frustrating about a table view
一件事有点令人沮丧的表视图
175
00:07:21,241 --> 00:07:24,309
is you've got the table view cells, which are UIViews,
你有表格视图细胞,ui视图,
176
00:07:24,377 --> 00:07:26,844
And then you've got the table view kind of that they're
然后你有他们的表视图类
177
00:07:26,913 --> 00:07:27,479
contained in,
包含在,
178
00:07:27,547 --> 00:07:29,147
That's a UIView also,
这是一个UIView也,
179
00:07:29,215 --> 00:07:31,149
And then you've got the table view controller behind it,
然后你有它背后的表格视图控制器,
180
00:07:31,218 --> 00:07:33,651
And you wanna set attributes on all of these things,
和你想要设置的属性在所有这些事情,
181
00:07:33,720 --> 00:07:38,523
So don't forget you can do Ctrl+Shift+Left-click, and
所以不要忘记你可以按Ctrl + Shift +左击,和
182
00:07:38,592 --> 00:07:39,424
it'll put up a little menu,
它会把一个小菜单,
183
00:07:39,492 --> 00:07:41,459
Says, okay, what thing under the mouse do you want?
说,好吧,什么事你想要在鼠标?
184
00:07:41,527 --> 00:07:44,796
Do you want the cell, the table view, or the controller?
你想要电池,表格视图,或控制器吗?
185
00:07:44,864 --> 00:07:48,800
And so that'll help you dig down to the thing you want,
这将帮助你挖到你想要的东西,
186
00:07:48,869 --> 00:07:50,368
All right, but once you have it selected,
好吧,但是一旦你已经选择它,
187
00:07:50,437 --> 00:07:52,203
whichever one you want, like the TableView or
哪个你想要的,像TableView或
188
00:07:52,272 --> 00:07:55,506
the Controller or the Cell, you can inspect it of course,
控制器或细胞,当然,你可以检查它
189
00:07:55,575 --> 00:07:59,877
Now, one important thing is this grouped versus plain that
现在,这是一个重要的分组和平原
190
00:07:59,946 --> 00:08:01,045
I showed you at the very beginning,
在一开始,我给你
191
00:08:01,114 --> 00:08:03,648
So here I'm gonna switch this one which is plain
这里我要换这一个平原
192
00:08:03,716 --> 00:08:05,182
over to grouped,
分组,
193
00:08:05,251 --> 00:08:07,352
So I'm just picking grouped in the style there,
所以我选择分组的风格,
194
00:08:07,421 --> 00:08:08,619
in the inspector,
在检查员,
195
00:08:08,688 --> 00:08:11,455
Another important attribute is dynamic versus static,
另一个重要的属性是动态和静态的,
196
00:08:11,524 --> 00:08:15,259
So dynamic is all the contents are coming from some database,
所以动态是所有的内容都来自一些数据库,
197
00:08:15,328 --> 00:08:18,363
And static is, I'm gonna put all the content right here in
和静态,我要把所有的内容在这里
198
00:08:18,431 --> 00:08:19,698
the story board, okay?
这个故事,好吗?
199
00:08:19,766 --> 00:08:21,199
So here we'll switch this one over to static,
这里我们将这个切换到静态的,
200
00:08:21,267 --> 00:08:25,570
So this is now a static, grouped table view,
这是现在一个静态,分组表视图,