Hi all,
Lets start the new year with some fun. I was always interested to create grid like structures in my app and for many times i tried third party tools to fulfill my need but this time i decided to work with Apple's UICollectionView and trust me its awesome.
I know its easy for many who have worked with them but for those who haven't here is a path to start.
You want to show a grid view layout on your view controller. For this we need 3 things :
1) UICollectionViewCell : This will decide the UI of the grid controls
2) UICollectionViewFlowLayout : This will provide the UI placements and positions
3) UICollectionViewController : This will help in UI rendering
First of all create a class named "CollectionViewCell" that is derived from UICollectionViewCell.
This class must have an attached XIB [though u can create programmatically too]. :)
CollectionViewCell.h
CollectionViewCell.m
CustomFlowLayout.h
CustomFlowLayout.m
CollectionViewController.h
CollectionViewController.m
Now here we set the collection view info
The important collection View DataSource Methods
&
Here is the final cartoon grid view
No comments:
Post a Comment