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
560
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
2
880
5分でSharePlay入門
tokorom
2
1.4k
HomeKit 2020
tokorom
7
2.4k
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
『Firebase Dynamic Links終了に備える』 FlutterアプリでのAdjust導入とDeeplink最適化
techiro
0
140
Taming you application's environments
salaboy
0
200
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
700
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
260
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
OTelCol_TailSampling_and_SpanMetrics
gumamon
1
220
強いチームと開発生産性
onk
PRO
35
11k
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
複雑なState管理からの脱却
sansantech
PRO
1
160
The Role of Developer Relations in AI Product Success.
giftojabu1
0
140
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
130
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
A better future with KSS
kneath
238
17k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
A Philosophy of Restraint
colly
203
16k
Building Your Own Lightsaber
phodgson
103
6.1k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Git: the NoSQL Database
bkeepers
PRO
427
64k
A Tale of Four Properties
chriscoyier
156
23k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Building an army of robots
kneath
302
43k
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