From 24972cb03d7a9ad30c635fd865ffe428788bda95 Mon Sep 17 00:00:00 2001 From: Chris Cox Date: Fri, 22 Apr 2016 16:54:50 -0400 Subject: [PATCH] [Collections] Updates to readme. Reviewers: iangordon, featherless, #mdc_ios_owners Reviewed By: iangordon, featherless, #mdc_ios_owners Subscribers: featherless Projects: #material_components_ios Differential Revision: http://codereview.cc/D746 --- components/Collections/README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/components/Collections/README.md b/components/Collections/README.md index b68b150d680..86e0a9fc971 100644 --- a/components/Collections/README.md +++ b/components/Collections/README.md @@ -2,14 +2,14 @@ title: "Collections" layout: detail section: components -excerpt: "Collection view classes that adhere to Material design layout and animation styling." +excerpt: "Collection view classes that adhere to Material design layout and styling." --- # Collections ![Collections](docs/assets/collections_screenshot.png) -Collection view classes that adhere to Material design layout and animation styling. +Collection view classes that adhere to Material design layout and styling. ### Material Design Specifications @@ -68,14 +68,14 @@ Before using Collections, you'll need to import it: #### Swift ~~~ swift -import MaterialCollections +import MaterialComponents.MaterialCollections ~~~ ### Use `MDCCollectionViewController` as a view controller -The following four steps will allow you to get a basic example to get a MDCCollectionViewController -up and running. +The following four steps will allow you to get a basic example of a `MDCCollectionViewController` +subclass up and running. Step 1: **Subclass `MDCCollectionViewController` in your view controller interface**. @@ -90,6 +90,8 @@ Step 1: **Subclass `MDCCollectionViewController` in your view controller interfa #### Swift ~~~ swift +import MaterialComponents.MaterialCollections + class MyCollectionsExample: MDCCollectionViewController { } ~~~ @@ -172,7 +174,8 @@ override func collectionView(collectionView: UICollectionView, The collection view controller provides a `styler` property that conforms to the `MDCCollectionViewStyling` protocol. By using this property, styling can be easily set for the collection view items/sections. In addition, by overriding `MDCCollectionViewStyleDelegate` -protocol methods in a collection view subclass, specific cells/sections can be styled differently. +protocol methods in a collection view controller subclass, specific cells/sections can be styled +differently. ### Cell Styles @@ -186,7 +189,7 @@ either set the styler `cellStyle` property directly, or use the protocol method // Set for entire collection view. self.styler.cellStyle = MDCCollectionViewCellStyleCard; - +// Or set for specific sections. - (MDCCollectionViewCellStyle)collectionView:(UICollectionView *)collectionView cellStyleForSection:(NSInteger)section { if (section == 2) { @@ -214,7 +217,7 @@ override func collectionView(collectionView: UICollectionView, ### Cell Height -The styling delegate protocol can be used to override the default cell height of 48.0f. +The styling delegate protocol can be used to override the default cell height of `48.0f`. #### Objective-C @@ -271,7 +274,7 @@ self.styler.gridColumnCount = 2 ### Cell Separators The styler allows customizing cell separators for the entire collection view. Individual -cell customization is also available by using a cell subclassed from `MDCCollectionViewCell`. +cell customization is also available by using an `MDCCollectionViewCell` cell or a subclass of it. Learn more by reading the section on [Cell Separators](../CollectionCells/#cell-separators) in the [CollectionCells](../CollectionCells) component.