Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
UITableVIewの中身を分割してみませんか?
tokorom
February 13, 2014
Technology
3
2.4k
UITableVIewの中身を分割してみませんか?
UITableViewの中身をUIViewControllerで分割する方法と、DataSource/Delegateだけを分割する方法のメリット/デメリット
tokorom
February 13, 2014
Tweet
Share
More Decks by tokorom
See All by tokorom
5分でSharePlay入門
tokorom
2
950
HomeKit 2020
tokorom
7
1.9k
Advanced Segue 2019年のSegue事情
tokorom
10
4.9k
tvOSアプリUIの勘所
tokorom
1
1.5k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
11k
古き良きsendAction (in potatotips #26)
tokorom
1
3.3k
画面遷移と私(iOS)
tokorom
4
3.5k
長生きするために心臓に悪いリリースはもうやめよう
tokorom
22
32k
potatotips#8 Swiftのライブラリを作成/利用しよう
tokorom
7
3.5k
Other Decks in Technology
See All in Technology
2年で10→70人へ! スタートアップの 情報セキュリティ課題と施策
miekobayashi
1
180
プログラミング支援AI GitHub Copilot すごいの話
moyashi
0
260
Pentesting Password Reset Functionality
anugrahsr
0
180
【NGK2023S】 ノードエディタ形式の画像処理ツール「Image-Processing-Node-Editor」
kazuhitotakahashi
0
180
それでもどうしてRecoilを使うのか / Harajuku.ts Meetup Recoil
okunokentaro
11
3.2k
NGINXENG JP#2 - 3-NGINX Plus・プロダクトのアップデート
hiropo20
0
110
スタメンのLeSSの導入と 事業部全体を巻き込んだ アウトカム文化への道のり
uuushiro
2
3k
Astroで始める爆速個人サイト開発
takanorip
12
8.2k
Startup Studio Sereal / Culture Deck
sereal
0
590
Dev Containers ことはじめ - 失敗から学ぶ開発環境運用法
streamwest1629
0
250
「私考える人、あなた作業する人」を越えて、プロダクトマネジメントがあたりまえになるチームを明日から実現していく方法/product management rsgt2023
moriyuya
60
38k
学びを仕事に繋げる
sansanbuildersbox
15
5.9k
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
29
7.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
226
16k
Code Reviewing Like a Champion
maltzj
508
38k
The Invisible Side of Design
smashingmag
292
48k
Documentation Writing (for coders)
carmenintech
51
2.9k
Six Lessons from altMBA
skipperchong
15
2.3k
No one is an island. Learnings from fostering a developers community.
thoeni
12
1.5k
Infographics Made Easy
chrislema
235
17k
It's Worth the Effort
3n
177
26k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
44
14k
The Art of Programming - Codeland 2020
erikaheidi
35
11k
Automating Front-end Workflow
addyosmani
1351
200k
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