Adam Chubbuck
Adam Chubbuck

Reputation: 57

Display object on all view controllers

I have several objects which I display throughout all of my ViewControllers.

I am wondering if there is a way to merge these objects into a single object and initialize the object from every ViewController in the project.

In essence, I am attempting to merge the objects (they are the same type and do the same thing) and make them globally accessible.

Ex.

@property (weak, nonatomic) IBOutlet UIProgressView *progressView;

I would like to display and access this UIProgressView from all ViewControllers.

Upvotes: 1

Views: 93

Answers (1)

Jef
Jef

Reputation: 4728

You can put these interface elements in a UIViewController subclass and then have all of your other viewControllers inherit from that one (i.e. an abstract superclass) in this way there is only one lot of code which covers them all.

Upvotes: 3

Related Questions