Reputation: 24426
I was told by some folks at WWDC that UICollectionView would be ideal for creating an EPG (Electronic Program Guide) style view in iOS, like the image below. However, I can't find any samples that are even close to this... does anyone know to go about it?
Upvotes: 2
Views: 5092
Reputation: 14477
Here is an example for creating an EPG Grid in swift using UICollectionView and custom UICollectionViewLayout https://github.com/CoderXpert/EPGGrid....
Upvotes: 1
Reputation: 5099
https://github.com/inspace-io/INSElectronicProgramGuideLayout UICollectionViewLayout for displaying electronic program guide which will help you.
Upvotes: 0
Reputation: 1
https://github.com/NOUSguide/NGVaryingGridView A GridView which allows to set individual Rects for the Cells. So you can define Cells with different Sizes, used for e.g. in Timetables, EPGs, etc.
Upvotes: 0
Reputation: 133
Well It looks simple, You just need one section in CollectionView and Height of each item same. To make length dynamic for item you just need this api where you can calculate your space and return a proper size.
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
this is one of UICollectionViewDelegateFlowLayout Protocol method. make sure your horizontal scrolling is enable for collection view, you can set it from storyboard.
Upvotes: 0
Reputation: 5776
In a lot of cases you'll be able to get it done by subclassing the UICollectionViewFlowLayout
class. But in this case, you gotta write your own layout. Because UICollectionViewFlowLayout
is for line-based layouts, where lines break at the end. But in this case that wouldn't work.
So a custom layout is the way to go. You might wanna check the WWDC sessions on custom layouts and Apple's documentation.
Upvotes: 1
Reputation: 31
I got the same question - I'm not sure but I think you (we) would have to subclass
UICollectionViewFlowLayout
In order to achieve this layout :P
Upvotes: 0