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
Multiple layout with UITableViewCell
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
yashigani
November 30, 2015
Programming
3.6k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Multiple layout with UITableViewCell
関モバ #8
yashigani
November 30, 2015
More Decks by yashigani
See All by yashigani
Hatena Engineer Seminar #10
yashigani
0
2.5k
Dependency Injection in iOS Apps
yashigani
2
540
Lazy stored property
yashigani
3
2.2k
Code reviewing in iOS app development
yashigani
9
4.6k
Useful 3 techniques developing in iOS Apps
yashigani
0
1.6k
Introduction to WebKitPlus
yashigani
2
2.5k
Types in Swift
yashigani
5
2.4k
Swift with apps by Hatena
yashigani
13
30k
What's new WebKit.framework
yashigani
2
1.6k
Other Decks in Programming
See All in Programming
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
160
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
210
Cloudflare is Agents
chimame
0
170
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
280
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
160
【デモ】Kiroで体験する仕様駆動開発|設計からコーディングまでAIと進める開発フロー
cmkudo
0
250
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
580
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
830
Flow は今どうなっているか
mizdra
PRO
0
650
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
1
140
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
670
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
710
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
870
Chasing Engaging Ingredients in Design
codingconduct
0
280
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
420
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
260
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
220
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
620
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.4k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
210
Crafting Experiences
bethany
1
260
The Pragmatic Product Professional
lauravandoore
37
7.4k
Transcript
.VMUJQMFMBZPVUXJUI 6*5BCMF7JFX$FMM @yashigani ؔϞό #8
yashigani id:yashigani_w @yashigani Mobile Application Engineer http://yashigani.hatenablog.com Hatena
None
͋ΔͷͰ͖͝ͱ
None
None
ඍົʹҧ͏ʜ
͍͔ʹͯ͠ෳͷ ϨΠΞτΛ࣮ݱ͢Δ͔
• ίʔυͰϨΠΞτΛ͍͡Δ • xibΛෳ༻ҙ͍͚ͯ͠Δ
ίʔυͰ͍͡Δ࡞ઓ
• Pros • Δ͜ͱࣗମ୯७ • Cons • ফ͑ΔView • Auto
Layoutͷઃఆ͕͍͠ • ϨΠΞτͷશ༰Λ௫Έʹ͍͘
ෳͷYJCΛ͏࡞ઓ
• Pros • NSLayoutConstraintΛϓϩύςΟʹ͠ͳͯ͘Α͍ • Auto LayoutͷࢦఆΛ୯७ʹͰ͖Δ • viewࣗମͷϓϩύςΟΛ͍͚Ͱ͖Δ •
Cons • ෳͷxibΛϝϯςφϯε͢Δඞཁ͕͋Δ • ܾΊࣄ͕૿͑Δ(͍ճ͠ʹ͘͞)
࣮ύλʔϯ
class EntryCell: UITableViewCell { @IBOutlet weak var titleLabel: UILabel! @IBOutlet
weak var thumbnailView:UIImageView? var entry: Entry! }
protocol EntryCellRepresentable { var tableView: UITableView! { get } func
registerEntryCell() func dequeueEntryCell(entry: Entry, forIndexPath indexPath: NSIndexPath) -> EntryCell }
extension EntryCellRepresentable { func registerEntryCell() { let ids = ["EntryCell",
"EntryCellWithImage"] ids.forEach { let nib = UINib(nibName: $0, bundle: nil) tableView.registerNib(nib, forCellReuseIdentifier: $0) } } func dequeueEntryCell(entry: Entry, forIndexPath indexPath: NSIndexPath) -> EntryCell { let id = entry.hasImage ? "EntryCellWithImage" : "EntryCell" let cell = tableView.dequeueReusableCellWithIdentifier(id, forIndexPath: indexPath) as! EntryCell cell.entry = entry return cell } }
·ͱΊ
• xibΛ͚ΔͱAuto LayoutҎ֎͍͚Ͱ͖Δ • OptionalΛ্खʹ͓͏ • protocol extension࠷ߴ • UIStackViewૣ͘ΘͤΖ
͋Γ͕ͱ͏͍͟͝·ͨ͠