I have used UICollection view to show items in grid layout.
For data source I have use 5*5 dimensional array.
And also I am returning 5 for numberOfItems in
The MultipleLineLayout was originally written for infinite scrolling, so there was a problem with that implementation for your use. It should look like this,
-(NSArray*)layoutAttributesForElementsInRect:(CGRect)rect {
NSMutableArray* attributes = [NSMutableArray array];
for(NSInteger i=0 ; i < self.collectionView.numberOfSections; i++) {
for (NSInteger j=0 ; j < [self.collectionView numberOfItemsInSection:i]; j++) {
NSIndexPath* indexPath = [NSIndexPath indexPathForItem:j inSection:i];
[attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]];
}
}
return attributes;
}