views:

28

answers:

1

Hey,

I've run into a little problem while developing a Core Data driven Quiz and be a bit confused about a best practice to solve my problem.

I have approximately five templates for the diffrent questions, wich will be loaded in case wich question is displayed. So I check wich template has question 1 and push the new question-template view into my navigation controller. Becuase its allways the same code I want to write a function (I came from php) wich gets the next question-id as argument and decide wich template will be loaded and push the next view into the navigation-controller.

What is the best practice to solve this problem? Can I write a function with access to the navigation-controller, and my Core Data classes. And if yes where I have to create this function?

Greetings, Mister-D

A: 

Okay I think I found an way but gets here another Error. I create a class called QuestionRouter and define an class method. I'll import this class into each viewController where it needed. The class method gets the correct template from Core Data without an problem. But now I wan't to load the correct view. For that I need to access the navigationController defined in my AppDelegate.

So how I can access the navigationController in my AppDelegate for another class?

Hope for an answer. Mister-D

Mister-D