cannyboy
cannyboy

Reputation: 24426

UICollectionView to make EPG

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?

enter image description here

Upvotes: 2

Views: 5092

Answers (6)

Adnan Aftab
Adnan Aftab

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

Michal Zaborowski
Michal Zaborowski

Reputation: 5099

https://github.com/inspace-io/INSElectronicProgramGuideLayout UICollectionViewLayout for displaying electronic program guide which will help you.

Upvotes: 0

user2582969
user2582969

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

jogi47
jogi47

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

Guido Hendriks
Guido Hendriks

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

Tom Albrecht
Tom Albrecht

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

Related Questions