0

I have classes: loginViewController, helloViewController, howAreYouViewController. I also have a class ActionsViewController.

The first 3 classes are initialized when it is appropriative. I want to call some methods from ActionsViewController (but it not allocated and instantiated as ViewController).

I use NSNotifications, but as ActionsViewController is not show on the screen yet, my notifications are not registered. How to fix it?

UPDATE

for example full scenario is:

loginViewController -> helloViewController (!)-> howAreYouViewController -> if user click some action go to ActionsViewController.

I want to run method '-(void)testMethod' from ActionsViewController in (!) via NSNotifications. In (!) ActionsViewController is not showed and as it I not initalise it.

  • Describe a full scenario. What is creating `ActionsViewController`, when and why? What are these notifications? – Wain Feb 10 '14 at 13:52
  • @Wain, for example full scenario is: loginViewController -> helloViewController (!)-> howAreYouViewController -> if user click some action go to ActionsViewController. I want to run method '-(void)testMethod' from ActionsViewController in (!). In (!) ActionsViewController is not showed and as it I not initalise it. – user3290318 Feb 10 '14 at 13:58
  • Why do you want to do that? Seems like a strange requirement. Should you be passing some initialisation data instead... – Wain Feb 10 '14 at 14:01
  • @Wain, I do not want to duplicate my code and method that I need created in ActionsViewController, also I run this method further in my app. – user3290318 Feb 10 '14 at 14:06
  • 3
    Then you should look at refactoring that code out into a helper, not adding a relationship between classes that otherwise wouldn't need it. – Wain Feb 10 '14 at 14:08

0 Answers0