ios UICollectionViewController

**1.UICollectionViewController **
1.是什么
用于管理视图的控制器,视图可以以多列多行的形式来展示数据,是从UITableViewController演变而来的,所以使用上与UITableViewController非常像

2.与表视图的异同点
相同点
UITableViewController

.tableView (UITableView)
.delegate (id)
.dataSource (id)

每一行的类型:UITableViewCell
加载数据关注 三问一答 (有几个分区 每个分区多少行 每行什么样子)

UICollectionViewController
.collectionView (UITableView)
.delegate (id)
.dataSource (id)

每一行的类型:UICollectionViewCell
加载数据关注 三问一答 (有几个分区 每个分区有几项 每项长什么样子)

不同
UITableViewController
a.UITableViewCell
默认自带了用于显示的三个视图

textLabel
detailTextLabel
imageView

b.布局
cell的摆放时系统定义好的,永远都是从上到下, 按顺序依次排列

UICollectionViewController
a.UICollectionViewCell
不带任何系统定义好的用于显示数据的视图,只能访问以下几个属性完成界面的定制

backgroundColor
backgroundView
contentView

b.布局
需要搭配一个独立的对象,来对视图中的多个项进行布局
布局对象:所属类型是 UICollectionViewLayout 或 其子类,系统提供了一个子类UICollectionViewFlowLayout (流式布局)

posted @ 2017-08-23 21:11  笑笑就好90  阅读(173)  评论(0编辑  收藏  举报