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.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
Built Our Own Background Agent at LayerX #aidevex_findy
layerx
PRO
9
3.8k
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
210
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
0
120
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
430
ソフトウェア設計に溶けるインフラ ― AWS CDK のインフラ認識論
konokenj
3
710
What's New in Android 2026
veronikapj
0
240
ITヒヤリハットを整理してみた ~ライフサイクルと原因から考える再発防止策~
koukimiura
1
120
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
160
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
140
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
190
テーブルをDELETEした
yuzneri
0
130
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
170
Featured
See All Featured
HDC tutorial
michielstock
2
760
Between Models and Reality
mayunak
4
380
Test your architecture with Archunit
thirion
1
2.3k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
Building the Perfect Custom Keyboard
takai
2
820
Docker and Python
trallard
47
4k
Making Projects Easy
brettharned
120
6.7k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
240
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Prompt Engineering for Job Search
mfonobong
0
390
How to train your dragon (web standard)
notwaldorf
97
6.7k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
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ૣ͘ΘͤΖ
͋Γ͕ͱ͏͍͟͝·ͨ͠