Reputation: 13
This is the code I am using to setup my collection view.
- (void) setUpCollectionView {
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
[flowLayout setMinimumInteritemSpacing:0.0f];
[flowLayout setMinimumLineSpacing:0.0f];
[flowLayout setItemSize:CGSizeMake(320, 566)];
[self.collectionView setPagingEnabled:YES];
[self.collectionView setCollectionViewLayout:flowLayout];
}
I am setting the item size of the flow layout to a set size. I want to know I can adjust this size for the current screen size the user is using. Thanks.
Upvotes: 0
Views: 704
Reputation: 104082
If your collection view is set up with constraints to make it adjust to the screen size, then set your cells size to be the same as the collection view.
[flowLayout setItemSize:CGSizeMake(self.collectionView.frame.size.width, self.collectionView.frame.size.height)];
Upvotes: 1