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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
2
500
デプロイ直後のレイテンシスパイクを調べたら、 Railsの仕様にたどり着いた
nhsykym
0
110
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
320
自分的「カンファレンスの楽しみ方」
syumai
0
190
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
1.5k
新卒PdEのリアル
ryu1013
1
420
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
440
XHTMLが残したもの
yosuke_furukawa
PRO
2
420
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
420
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
1
1.2k
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Designing for humans not robots
tammielis
254
26k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
230
It's Worth the Effort
3n
188
29k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
590
Claude Code のすすめ
schroneko
67
230k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Optimizing for Happiness
mojombo
378
71k
Discover your Explorer Soul
emna__ayadi
2
1.3k
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ૣ͘ΘͤΖ
͋Γ͕ͱ͏͍͟͝·ͨ͠