I cannot provide the code exactly; but thatโs basically what you want to do.
1 - create an intermediate class headingRouter ; whose goal will be to mediate between the scrollView header (collectionView or tableView) and cell selection. The header router instance will live in your main collectionView level methods.
2 - headers and footers - this is what is called supplementary view ; therefore, they can be assigned any custom uiView subclass. In this headerView; you should have a method that accepts an identifier, perhaps id and changes the displayed image. You can animate this change with a fade out if you want it to look like iTunes.
3 - On your focused cell section; cellForRowAt cells have an identifier that is assigned during the cellForRowAt method in your delegate / data source methods. When a particular look is focused; Using one of the various collection / tableView methods You want to take this identifier; transfer it to your headingRouter , which in turn will notify your header to change its image to the corresponding image (possibly stored in the cache) for the image you are focusing.
This is more of an implementation logic; but you havenโt published any code, so thereโs no particular path to specifics.
Hooray
leahyjwilliam
source share