I'm currently working on an app. I need to create mixed static and dynamic rows in a UIViewCollection. I need to fill the first and the second row with static UIImage and UILabel. Then the dynamic content should be started from 3rd row. How to do that?
I'm creating this programmatically using Swift 3 without Storyboard.
Any help would be appreciated!
The reason why you would like to use static cells, is because the user interface on these cells will be always the same. Also, you would like to no separator between the cells.
I would rather recommend to place
UIView
above theUICollectionView
, than introducing static cells for this purpose. You can draw theUIView
to be mimicking the look of the cells, what would also solve the problem of not having the separator between the "static cells".The other reason, why a
UIView
would be a better approach, because you do not mess up your dataSource, especially, when it comes toIndexPath
's.Last thing, the UI really looks like something, what could be solved with a
UITableView
. Is there a particular reason, why u are usingUICollectionView
?EDIT: If you are using
UITableView
, you can just assign this view to thetableView
'stableHeaderView
property inviewDidLayoutSubviews
or inviewWillAppear
.Example: