开发者

Best practice for View-Routing in iPhone SDK

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 different questions, which will be loaded in case which question is displayed. So I check which template has question 1 and push the new question-template view into my navigation controller. Because its always the same code I want to write a function (I came from php) which gets the next question-id as argument and decide whic开发者_运维技巧h 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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜