user3745888
user3745888

Reputation: 6353

How to change height of UICollectionView outlet?

I have and UICollectionView and I want change programmatically the height of collectionView.

I'm using:

[self.myCollectionInStoryboard.collectionViewLayout collectionViewContentSize];

- (CGSize)collectionViewContentSize
 {   
   return CGSizeMake([[UIScreen mainScreen] bounds].size.width, 800);
}

But it isn't work... I have added this to my viewController:

<UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>

How can I change this height property to my collectionView? Thanks!

Upvotes: 0

Views: 448

Answers (1)

Robert J. Clegg
Robert J. Clegg

Reputation: 7370

That code does not do what you think it does. You can change the UICollectionView's frame property like so: self.myCollectionView.frame = CGRectMake(0,0,[UIScreen mainScreen] bounds].size.width, 800)

Upvotes: 3

Related Questions