UICollectionViewController How to resize a cell?

I get a headache trying to resize a cell (width and height) in a UICollectionViewController . With UITableViewController there is a method:

 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 

But with the UICollectionViewController I cannot find a way to do this programmatically.

I have a UICollectionViewCell , but it is not.

How to resize a cell in a UICollectionViewController ?

+4
source share
1 answer

It looks like you need to use UICollectionViewFlowLayout and UICollectionViewFLowLayoutDelegate and implement

 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 

Check out the Ray Wenderlich tutorial: http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12

+5
source

Source: https://habr.com/ru/post/1443681/


All Articles