IOS UICollectionViewContoller, iosviewcontroller

Source: Internet
Author: User

IOS UICollectionViewContoller, iosviewcontroller

1. What

TheUICollectionViewControllerClass represents a view controller whose content consistsA collection view.

TheUICollectionViewClass manages an ordered collection of data items and presents them using customizable layouts.


2. Why

Collection views provide the same general function as table views doesn't that a collection view is able to support more than just single-column layouts. collection views support customizable layouts that can be used to implement multi-column grids, tiled layouts, circular layouts, and more. you can even change the layout of a collection view dynamically if you want.


3. How

3.1 UICollectionViewLayout (describe the layout information of CollectionView)

The job of a layout object is to determine the placement of cells, supplementary views, and decoration views inside the collection view's bounds and to report that information to the collection view when asked. the collection view then applies the provided layout information to the corresponding views so that they can be presented onscreen.


Collection views haveThreeTypes of visual elements that need to be laid out:

  • CellsAre 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 viewsPresent 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 viewsAre 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.


Methods to Override (Required) // Refer to the workshop document.

Optimizing Layout Performance Using Invalidation Contexts // refer to the optimize document.

3.2 UICollectionViewCell (the item that makes up CollectionView)

AUICollectionViewCellObject presents the content for a single data item when that item is within the collection view's visible bounds.

Similar to UITableViewCell


In summary, both the UITableView and UICollectionView can be depicted and richer. As for the Development selection, we should proceed according to the actual scenarios and requirements.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.