Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to reload a collectionview that is inside a tableviewcell

I have a collectionView inside a tableViewCell

for example: example credit: How to use StoryBoard quick build a collectionView inside UITableViewCell

I would like to reload the collectionView when I update information.

I have put a print in the collectionView's cellForItemAtIndexPath to test if it is being called but it isn't. How can I get the collectionView to reload?

like image 665
stephw Avatar asked Feb 25 '16 08:02

stephw


People also ask

How do I create a collection view?

Create a new iOS app projectAdd a CollectionView by pressing command shift L to open the storyboard widget window. Drag the collectionView onto the main view controller. Add constraints to the UICollectionView widget to ensure that the widget fills the screen on all devices.

What is a collection view?

A collection view manages an ordered set of content, such as the grid of photos in the Photos app, and presents it visually. Collection views are a collaboration between many different objects, including: Cells. A cell provides the visual representation for each piece of your content.


1 Answers

I found out how! In my tableViewCell class I just need to link the collectionView as an outlet so in my tableViewCell's cellForRowAtIndexPath I just needed to call cell.collectionView.reloadData()

like image 122
stephw Avatar answered Sep 16 '22 15:09

stephw