vinylDeveloper
vinylDeveloper

Reputation: 707

Can Multiple UIViewControllers that use the same animations call them from a common class?

I have what I think should be a fairly simple implementation, but I'm running into some problems.

I have 3 UIViewControllers that all use the same animation functions. The only thing that changes are the Images that go with the animations. Their animation paths are all identical.

My question is, can I create a common class to hold these animation functions, and just change the images within each UIViewController when I call the function, or does each animation have to be coded within each specific UIViewController. I must be able to as that is the whole basis of OOP. But I can't seem to call these functions from my UIViewController.

Can anyone send me in the right direction? Thanks.

Upvotes: 1

Views: 93

Answers (2)

vinylDeveloper
vinylDeveloper

Reputation: 707

I did find out how to do it though if anyone is interested. What I did was make a OperationsClass that is a subclass of UIViewController. There I put all my operations methods. My touches, my animations, etc... everything that is common. Then I subclassed my OperationsClass and made new ViewController classes to load my nibs and other options that are different.. Don't know if its right, but seems to work so far.

Upvotes: 1

Jorge Ramos
Jorge Ramos

Reputation: 891

Just a question: Are you using a UINavigationController? If not, maybe this is the answer you’re looking for... (link to documentation)

Upvotes: 1

Related Questions