Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fernandojinzenji/1107b2251e47783b352fbabfbfb791d5 to your computer and use it in GitHub Desktop.
Save fernandojinzenji/1107b2251e47783b352fbabfbfb791d5 to your computer and use it in GitHub Desktop.
Week 3, Wednesday - Readings and Questions
Question 1:
a) Both collection views and table views are controls to display information to the user. Table views are used to display in
a traditional tabular view, but collection views allows more flexibility in the layout of those information.
b) Collection views allow the data to be displayed horizontally (multiple itens in the same row), add supplimentary views (like
"headers and footers" for each item and even use decorator views to customize the background of each row.
Question 2:
- Cell Views - are the main elements positioned by the layout. Each cell represents a single data item in the collection.
A collection view can have a single group of cells or it can divide those cells into multiple sections. The layout object’s
main job is to arrange the cells in the collection view’s content area.
- Supplementary Views - present data but are different than cells. Unlike cells, supplementary views cannot be selected by
the user. Instead, you use supplementary views to implement things like header and footer views for a given section or for
the entire collection view. Supplementary views are optional and their use and placement is defined by the layout object.
- Decoration Views - are visual adornments that cannot be selected and are not inherently tied to the data of the collection
view. Decoration views are another type of supplementary view. Like supplementary views, they are optional and their use
and placement is defined by the layout object.
Question 3:
- collectionViewContentSize - Returns the width and height of the collection view’s contents.
- layoutAttributesForElements - Returns the layout attributes for all of the cells and views in the specified rectangle.
- layoutAttributesForItem - Returns the layout attributes for the item at the specified index path.
- shouldInvalidateLayout - Asks the layout object if the new bounds require a layout update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment