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
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.4k
Dependency Injection in iOS Apps
yashigani
2
530
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
JavaDoc 再入門
nagise
1
410
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
120
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.5k
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
220
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
360
スマートグラスで並列バイブコーディング
hyshu
0
260
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.2k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
230
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
260
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
570
Creating Composable Callables in Contemporary C++
rollbear
0
160
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.7k
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
280
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Design in an AI World
tapps
1
250
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
470
Prompt Engineering for Job Search
mfonobong
0
350
The SEO identity crisis: Don't let AI make you average
varn
0
500
Skip the Path - Find Your Career Trail
mkilby
1
150
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Optimizing for Happiness
mojombo
378
71k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
210
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ૣ͘ΘͤΖ
͋Γ͕ͱ͏͍͟͝·ͨ͠