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
610
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
3
900
5分でSharePlay入門
tokorom
3
1.4k
HomeKit 2020
tokorom
7
2.5k
Advanced Segue 2019年のSegue事情
tokorom
9
5.8k
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
20241220_S3 tablesの使い方を検証してみた
handy
3
200
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
620
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
530
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
250
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
2
240
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
250
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
240
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
Postman と API セキュリティ / Postman and API Security
yokawasa
0
200
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
440
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
How STYLIGHT went responsive
nonsquared
95
5.2k
It's Worth the Effort
3n
183
28k
Code Reviewing Like a Champion
maltzj
520
39k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Speed Design
sergeychernyshev
25
670
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
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