I\'m using an UICollectionView
on which I want to place seven cells side by side. The whole screen should be used for this. Currently, I\'m using the width of the c
Try this out, declare these variables
NSInteger insets_Top=5;
NSInteger insets_Bottom=5;
NSInteger insets_Left=5;
NSInteger insets_Right=5;
and add these methods
- (CGSize)collectionView:(UICollectionView *)collectionView layout: (UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath: (NSIndexPath *)indexPath
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGSize img_size=CGSizeMake(screenWidth/num_items- (insets_Right+insets_Left), screenWidth/num_items);
return img_size;
}
- (UIEdgeInsets)collectionView:
(UICollectionView *)collectionView layout: (UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex: (NSInteger)section
{
return UIEdgeInsetsMake(insets_Top,insets_Left,insets_Bottom,insets_Right);
}
Here num_items=7 as in your case you want number of cells in a row to be 7