Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UITableVIewの中身を分割してみませんか?
Search
tokorom
February 13, 2014
Technology
3
2.5k
UITableVIewの中身を分割してみませんか?
UITableViewの中身をUIViewControllerで分割する方法と、DataSource/Delegateだけを分割する方法のメリット/デメリット
tokorom
February 13, 2014
Tweet
Share
More Decks by tokorom
See All by tokorom
続・SharePlayの歴史と進化 iOS18とApple Vision Proにおける新展開
tokorom
3
690
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
3
930
5分でSharePlay入門
tokorom
3
1.5k
HomeKit 2020
tokorom
7
2.5k
Advanced Segue 2019年のSegue事情
tokorom
9
5.9k
tvOSアプリUIの勘所
tokorom
1
2k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
12k
古き良きsendAction (in potatotips #26)
tokorom
1
3.6k
画面遷移と私(iOS)
tokorom
4
3.7k
Other Decks in Technology
See All in Technology
データ基盤の成長を加速させる:アイスタイルにおける挑戦と教訓
tsuda7
3
650
現場の種を事業の芽にする - エンジニア主導のイノベーションを事業戦略に装着する方法 -
kzkmaeda
2
1.5k
Larkご案内資料
customercloud
PRO
0
600
現場で役立つAPIデザイン
nagix
29
10k
君はPostScriptなウィンドウシステム 「NeWS」をご存知か?/sunnews
koyhoge
0
720
滅・サービスクラス🔥 / Destruction Service Class
sinsoku
6
1.5k
家電アプリ共通PF "Linova" のAPI利用とPostman活用事例ご紹介
yukiogawa
0
130
20250208_OpenAIDeepResearchがやばいという話
doradora09
PRO
0
170
Classmethod AI Talks(CATs) #15 司会進行スライド(2025.02.06) / classmethod-ai-talks-aka-cats_moderator-slides_vol15_2025-02-06
shinyaa31
0
170
FastConnect の冗長性
ocise
1
9.6k
Culture Deck
optfit
0
330
CZII - CryoET Object Identification 参加振り返り・解法共有
tattaka
0
240
Featured
See All Featured
Designing on Purpose - Digital PM Summit 2013
jponch
117
7.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
A designer walks into a library…
pauljervisheath
205
24k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Optimizing for Happiness
mojombo
376
70k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Typedesign – Prime Four
hannesfritz
40
2.5k
Adopting Sorbet at Scale
ufuk
74
9.2k
Fireside Chat
paigeccino
34
3.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
240
Transcript
UITableViewͷதΛ ׂͯ͠Έ·ͤΜ͔ʁ ॴ ༑ଠ @tokorom iOS App Programer These are
“not” confidential sessions—please diffuse by your blogging and twitter potatotips #4
Α͋͘Δ͜͏͍͏ը໘ͷ࣮ ϐοΫΞοϓ ࠷৽ Φεεϝ
ౖᔶͷSwitchจ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row
= indexPath.row; NSUInteger section = indexPath.section; switch (section) { case MMSectionXXX: { MMXXXCell *cell = (MMXXXCell *)[self.tableView dequeueReusableCellWithIdentifier:@"MMXXXCell"]; if (nil == cell) { cell = [[MMXXXCell alloc] initWithReuseIdentifier:@"MMXXXCell"]; } cell.xxx = yyy; ɹɹɹɹɹ } break; case MMSectionYYY: case MMSectionZZZ:
ౖᔶͷ௨৴ϦΫΤετͱදࣔ -ϐοΫΞοϓίϯςϯπΛऔಘͯ͠දࣔ -৽ணίϯςϯπΛऔಘͯ͠දࣔ -ΦεεϝίϯςϯπΛऔಘͯ͠දࣔ
ίϯςϯπ͝ͱʹControllerΛ ͚͍ͨΑͶ
ViewControllerΛ͚Δ UIViewController UIViewController UIViewController
ϝϦοτ -͍׳ΕͨViewControllerΛ͑Δ -൚༻ੑ͕ߴ͍
σϝϦοτ -ΩϟογϡͷΈ͕͍ͮΒ͍ -දࣔ͞Ε͍ͯͳ͍෦ͷίϯςϯπऔಘ͠ͳ͚Ε ͳΒͳ͍ʢ͜ͱ͕͋Δʣ -TableView in TableView ͷϦεΫ͕͋Δʁ
DataSource/DelegateΛ͚Δ DataSource 1 DataSource 2 DataSource 3
֤ηΫγϣϯͷControllerʹॲཧΛৼΓ͢ section 1 x row 1 section 1 x row
3 section 1 x row 3
ϝϦοτ -ηΫγϣϯΛ·͍ͨͰΩϟογϡ͕ར༻Ͱ͖Δ -;ͭ͏ͷTableViewͷ͍ํͳͷͰϦεΫ͕গͳ͍
σϝϦοτ -֤ηΫγϣϯʢControllerʣʹৼΓ͚Δͷ͕໘ ͍͘͞
https://github.com/tokorom/ TKRContainerTableViewController
ϝΠϯͷViewController - (void)viewDidLoad { [super viewDidLoad]; ! [self addController:[PickupController new]];
[self addController:[ListController new]]; [self addController:[ListController new]]; }
֤ηΫγϣϯͷController - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell
= [tableView dequeueReusableCellWithIdentifier:kCellIdentifier]; cell.textLabel.text = [NSString stringWithFormat:@"list %d", indexPath.row]; cell.imageView.image = [UIImage imageNamed:@"Dog"]; return cell; }
·ͱΊ -̍ͭͷViewControllerͰ͍ΖΜͳίϯςϯπΛ ѻ͏ͷࢭΊΑ͏ -ίϯςϯπ͕ݶఆతͳ߹ʹηΫγϣϯ͝ͱʹ addChildViewControllerΛ͚Δͷ༗༻ -ࠓͷͱ͜ΖDataSource/DelegateΛׂ֤ͯ͠ ControllerʹৼΓ͚Δͷ͕҆શʁ
More Information Yuta ToKoRo! iOS App Programer! @tokorom! ! http://www.tokoro.me/
https://github.com/tokorom/TKRContainerTableViewController