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
UICollectionView Introduction
Search
Maciej Oczko
July 26, 2014
Programming
0
61
UICollectionView Introduction
Presentation prepared for UICollectionView workshop in Warsaw.
Maciej Oczko
July 26, 2014
Tweet
Share
More Decks by Maciej Oczko
See All by Maciej Oczko
Dependency Injection on iOS
maciejoczko
1
120
Working with Legacy Code (Łódź)
maciejoczko
0
53
iOS TDD Workshop (Gdańsk)
maciejoczko
1
81
UICollectionView Basics and Flow Layout
maciejoczko
0
230
Working With Legacy Code - iOS TDD Workshop
maciejoczko
0
170
Depenedency Injection in iOS
maciejoczko
0
69
Other Decks in Programming
See All in Programming
状態と共に暮らす:ステートフルへの挑戦
ypresto
3
1.2k
データと事例で振り返るDevin導入の"リアル" / The Realities of Devin Reflected in Data and Case Studies
rkaga
3
1.9k
Boast Code Party / RubyKaigi 2025 After Event
lemonade_37
0
100
Instrumentsを使用した アプリのパフォーマンス向上方法
hinakko
0
250
Ruby で作る RISC-V CPU エミュレーター / RISC-V CPU emulator made with Ruby
hayaokimura
5
1.1k
eBPF超入門「o11yに使える」とは (20250424_eBPF_o11y)
thousanda
1
120
カウシェで Four Keys の改善を試みた理由
ike002jp
1
140
Flutterでllama.cppをつかってローカルLLMを試してみた
sakuraidayo
0
150
ニーリーQAのこれまでとこれから
nealle
2
810
Beyond_the_Prompt__Evaluating__Testing__and_Securing_LLM_Applications.pdf
meteatamel
0
110
AIコーディングエージェントを 「使いこなす」ための実践知と現在地 in ログラス / How to Use AI Coding Agent in Loglass
rkaga
4
1.4k
Rubyの!メソッドをちゃんと理解する
alstrocrack
1
310
Featured
See All Featured
Producing Creativity
orderedlist
PRO
344
40k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.7k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
24
2.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
33k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.8k
A designer walks into a library…
pauljervisheath
205
24k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
The Cult of Friendly URLs
andyhume
78
6.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Bash Introduction
62gerente
613
210k
Building Applications with DynamoDB
mza
94
6.4k
Transcript
UICollectionView
@maciejoczko #UICollectionViewWarsaw
INTRO
UICollectionView
UICollectionView + Flow Layout
iOS 6 Introduced in
UI != NS
UITableView New
UITableView Sibling of
UIScrollView UICollectionView UITableView
is mostly about UICollectionView
GRIDS
GRIDS
GRIDS
None
None
None
MORE GRIDS
None
None
None
None
OTHERS
None
None
UI
cell supplementary view decoration view
cell No predefined cell styles New way of creation Tied
to content
supplementary view Tied to data but separate from cells View
of a kind
decoration view Not tied to content
cell supplementary view decoration view recap
Layout UICollectionView
Layout animations
Layout transitions
Layout posi tion
Layout Subclassing
UICollectionViewLayoutAttributes
UICollectionViewLayoutAttributes frame
UICollectionViewLayoutAttributes frame alpha
UICollectionViewLayoutAttributes frame alpha zIndex
UICollectionViewLayoutAttributes frame alpha zIndex center
UICollectionViewLayoutAttributes frame alpha zIndex center size
UICollectionViewLayoutAttributes frame alpha zIndex center size hidden
UICollectionViewLayoutAttributes frame alpha zIndex center size hidden transform 3D
Layout animations recap transitions positioning subclassing
Collection
UICollectionView DataSource
DataSource collectionView:cellForItemAtIndexPath: collectionView:numberOfItemsInSection: collectionView:viewForSupplementaryElementOfKind: atIndexPath: numberOfSectionsInCollectionView:
DataSource collectionView:cellForItemAtIndexPath: collectionView:numberOfItemsInSection: collectionView:viewForSupplementaryElementOfKind: atIndexPath: numberOfSectionsInCollectionView:
collectionView:cellForItemAtIndexPath: { MyCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@”MY_CELL_ID”]; if (!cell) {
cell = . . . } // Configure the cell's content return cell; }
collectionView:cellForItemAtIndexPath: { MyCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@”MY_CELL_ID”]; if (!cell) {
cell = . . . } // Configure the cell's content return cell; }
collectionView:cellForItemAtIndexPath: { MyCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@”MY_CELL_ID”]; // Configure the
cell's content return cell; }
collectionView:cellForItemAtIndexPath: { MyCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@”MY_CELL_ID”]; // Configure the
cell's content return cell; }
collectionView:cellForItemAtIndexPath: { MyCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@”MY_CELL_ID” forIndexPath:indexPath]; // Configure
the cell's content return cell; }
collectionView:cellForItemAtIndexPath: { MyCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@”MY_CELL_ID” forIndexPath:indexPath]; // Configure
the cell's content return cell; }
[collectionView registerClass:[MyCell class] forCellWithReuseIdentifier:@“MY_CELL_ID”]
[collectionView registerClass:[MyCell class] forSupplementaryViewOfKind:@“MY_KIND” withReuseIdentifier:@“MY_CELL_ID”]
[collectionView registerClass:[MyCell class] forDecorationViewOfKind:@“MY_KIND”
The same pattern in UITableView since iOS6
View
UICollectionView Delegate
Delegate Layout transition callback Tracking the removal of views Menu
actions callbacks Selection & highlight tracking callbacks
Layout Flow
Layout Flow UICollectionView
Layout Line oriented
group of lines grid OR
Predefined supplementary views HEADER FOOTER
Customization
itemSize
minimum inter item spacing 10 10
minimum line spacing 10 10
scroll direction HORIZONTAL VERTICAL
HEADER FOOTER reference sizes
section insets
UICollectionViewFlowLayout instance properties setting values UICollectionViewDelegateFlowLayout
Powerful Flow Layout is
Thanks! @maciejoczko
CREDITS screenshots: native apps & AppStore color palette: electrikmonk http://www.colourlovers.com/palette/1930/cheer_up_emo_kid
Q&A
https://github.com/literator/ UICollectionViewWorkshop