Tip: 致敬@简书
最终效果

新建一个项目
1. 选择Single View Application模板

New Project
2. 删除Main.storyborad中的默认ViewController

Delete View Controller Scene
3. 删除文件列表中的ViewController.h && ViewController.m

Delete XX.h&&XX.m
新建并设置Collection View Controller
1. 拖拽一个Collection View Controller到Main.Storyboard中

Drag Collection View Controller
2. 在Attributes Inspector中,设置为Is Initial View Controller

Set Initial
3. New File , 继承自UICollectionViewController

New Controller
4. 回到Main.storyboard,设置Collection View Controller的Custom Class

Set Custom Class
新建并设置Collection View Cell
1. New File,继承自UICollectionViewCell

New Cell Class
2. 回到Main.storyborad,设置Collection View里Cell视图的Custom Class

Set Custom Class
3. 布置Cell,调整Cell的大小,添加ImageView并配上合适的图片,添加Label

Config Cell
4. 关联Cell视图中的Image View 和 Label控件到CollectionViewCell.h

Outlet
实现协议
1. 返回每个Section的item的个数

Return Item Number
2. 返回Cell

Return Cell
关键点
1. kReuseId = "Mycell",这里的值需要和下图中的配置一致

Key1
2. 使用Identifier后,不能用代码注册Cell(你可以试一试)

Key2