I'm creating an EPG (Electronic Program Guide); to retrieve the program info I use JSON. For the design, I have a table view in the left half for the channel logo and name, and in the right half a collection view for all the TV programs for that channel. The thing is that for every show the collection view row must have a different width that depends on the duration of the show.
I'm building it based on this fantastic example called: EPG Grid
But in this example, all the channels are loaded previously in one array. This works fine if the channels list is short, but in my case the list is very large, so I need to load every channel in tableView:cellForRowAtIndexPath:
, then create the layout with the specified width.
Any thoughts about this?
I figured out by my self, the thing is in my case not to use
UICollectionViewLayout
(CustomLayout) use layoutFlow
and add thecollectionView
insidetableView
like this:Then in every row of
tableView
delegate thecollectionView
.After delegate, the method
collectionView:sizeForItemAtIndexPath
is called, on this method you must to calculate width or height retrieving data using indexPathFinally for making the scroll uniform for all the cells at the same time use the method
scrollViewDidScroll
. Check this post: Horizontally scroll ALL rows of UICollectionView together