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
2.6k
3
Share
UITableVIewの中身を分割してみませんか?
UITableViewの中身をUIViewControllerで分割する方法と、DataSource/Delegateだけを分割する方法のメリット/デメリット
tokorom
February 13, 2014
More Decks by tokorom
See All by tokorom
CursorでアプリをBuild/Lint
tokorom
0
260
続・SharePlayの歴史と進化 iOS18とApple Vision Proにおける新展開
tokorom
3
1.1k
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
3
1.2k
5分でSharePlay入門
tokorom
3
1.6k
HomeKit 2020
tokorom
7
2.8k
Advanced Segue 2019年のSegue事情
tokorom
9
6.4k
tvOSアプリUIの勘所
tokorom
1
2.4k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
13k
古き良きsendAction (in potatotips #26)
tokorom
1
3.9k
Other Decks in Technology
See All in Technology
Geek Woman の育ち方 〜コミュニティとAIと〜
chicaco
0
340
AI時代に求められる思考のパラダイムシフト
nrinetcom
PRO
1
130
ソフトウェアサプライチェーン攻撃対策として今からサクッとできること
flatt_security
2
110
論文紹介:Pixal3D (SIGGRAPH 2026)
tenten0727
0
690
TypeScriptはどのようにどこまで推論できるのか ─ とにかく as は禁止で
ypresto
1
350
Kaggle未経験社員をメダリストに育てる「AIドラゴン桜」
lycorptech_jp
PRO
0
260
ラズパイ & Picoで入門:Zephyr(RTOS)の環境構築からビルドまでの紹介
iotengineer22
0
200
TSKaigi 2026 - enumよ、さようなら
teamlab
PRO
2
380
AI全盛の今だからこそ、あえてもう一度振り返るAPIの基礎
smt7174
3
150
データ基盤構築・運用の現場から 〜 Snowflake Intelligence 導入で変わった、データ活用の未来 〜
wonohe
0
150
まだ道半ば、AI-DLCを歩み始めている話
news_it_enj
2
110
コーディングエージェントはTypeScriptの 型エラーをどう自己修正しているのか
melonps
3
350
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
3
3.3k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
140
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Designing Experiences People Love
moore
143
24k
The Limits of Empathy - UXLibs8
cassininazir
1
330
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
340
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
380
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
530
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
300
Design in an AI World
tapps
1
210
GraphQLとの向き合い方2022年版
quramy
50
15k
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