首页 > 移动平台 > 详细

iOS UICollectionViewContoller相关

时间:2015-06-22 16:21:24      阅读:216      评论:0      收藏:0      [点我收藏+]

1.What

The UICollectionViewController class represents a view controller whose content consists of a collection view.

The UICollectionView class 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 except 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 many more. You can even change the layout of a collection view dynamically if you want.


3.How

3.1 UICollectionViewLayout(描述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 have three types of visual elements that need to be laid out:

  • Cells 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.


Methods to Override (Required)//参照 文档

Optimizing Layout Performance Using Invalidation Contexts //参照 文档

3.2 UICollectionViewCell(组成CollectionView的item)

UICollectionViewCell object presents the content for a single data item when that item is within the collection view’s visible bounds.

类似UITableViewCell


综述,UITableView可以描绘的视觉,UICollectionView都可以描绘,而且更丰富。至于开发选择,还是根据实际的场景和要求来进行。


iOS UICollectionViewContoller相关

原文:http://blog.csdn.net/forwardto9/article/details/46593771

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!