Adopt protocols UICollectionViewDataSource and UICollectionViewDelegateFlowLayout and implement protocol methods.