0

I am building an iOS objective-c application with multiple scenes across the app.

I have just finished building out one scene that features a collection view of images and details about those images and have added different functions related to that collection view in the .m file for that scene.

My question is, what is the easiest way to replicate this collection view in a different scene in my app?

Is there a way to just import the collection view from my first scene and not have to rewrite all of the functions and initializations for my collection view?

For your reference, I have declared the collection view as:

@property (weak, nonatomic) IBOutlet UICollectionView *collectionViewPopularUploads1;

In my first scene.

Roger99
  • 981
  • 2
  • 11
  • 42
  • View only: [create a XIB](https://stackoverflow.com/questions/30335089/reuse-a-uiview-xib-in-storyboard). View including functionality (ViewController): Use a [ContainerView](https://stackoverflow.com/questions/37370801/how-to-add-a-container-view-programmatically). – shallowThought Jun 12 '17 at 16:17

1 Answers1

1

Create your own collectionView class that will inherit from UICollectionView. Write there all your functionality and initializators and reuse it in any scene.

iamirzhan
  • 914
  • 5
  • 16