Understanding how application delegates and view controllers relate to each other

I am trying to understand the basics of MVC Cocoa (Iphone) design, but it is rather complicated. I came across several sample applications, from the Internet, books .. but I did not find anything related to what I am looking for, since most of the examples are just a simple application (i.e. a viewcontroller with flipside viewcontr and a little more ..) . So let's see if anyone wants to help me point me in the right direction:

  • My goal is to create a somewhat complex application. I would like to have the following attitude of views:

    • View representation (which will have a controller loading multiple intensive memory)

    • View of the main menu: various options that will lead to completely new complex views. As an example, the โ€œStartโ€ parameter to initiate everything that the application permits; the second option to perform another complex task with various views and actions inside it, the option "Parameters" to configure the parameters; help option, option, etc.

  • In the first approach, I tried to embed a few rounded buttons in the view under the MainWindow heading with an associated application delegate. This approach raised the question of how I manage to switch between view / viewcontrollers. After I did not rule out the exception, because I probably did not fully understand the basics, I tried to move on to the โ€œsimplerโ€ things.

  • Then I went over to the default controllers of Cocoa navigation and Tabbar. I do not need a tab, although this may come in handy for other parts of this application. Then the navigation controller is what I consider the most suitable for this case.

  • So, I am in the right place, if I create a hierarchical application, where its root is the navigation controller? I saw that I can customize the main view to display a customized table, where each cell phone acts as a button to create its own corresponding view + viewcontroller. From here I can continue to build the "leaf nodes" of this hierarchy of views / viewcontrollers, right? Although I don't like the animation that the navigation controller provides by default, I assume that I can get rid of it.

  • So, to summarize in a simple way: I would like to get a menu similar to what is usually seen in Cocos2d applications.

It's hard to ask about this, I know that this should be easy, but I find the documentation is rather messy, as well as the examples I saw. GUI programming is a complex learning curve: /

Thanks for any answers in advance, and excuse me for this long post.

+7
iphone cocoa
source share
2 answers

So I am in the right place if I create a hierarchical application in which its root is the navigation controller?

Nearly. The nav controller (even though it is a subclass of the UIViewController) does not control views, but rather other view controllers. The nav controller pushes and pushes view controllers, which, in turn, cause the dispatcher to load the corresponding views and become visible.

Therefore, the "root view" is actually a view that is controlled by the view controller, which is located in the nav controller topViewController .

The application delegate serves to store the navigation controller and to indicate which view controller first clicks on the stack. After that, the view controllers tell the navigation controller when to click and place them.

Otherwise, you are on the right track. You should always try to present information on the mobile platform in a hierarchical manner, starting with the most general at the top and increasing more specifically when you expand.

And you should not be embarrassed if you find this confusing. 90% of background / instructional information, including Apple books and resources, focuses on aspects of the Gee Whiz interface and doesn't tell you anything about the actual design of the app or how all the parts fit together conceptually.

+7
source share

You are right about how little information there is about application delegates for navigation controllers. I dug and tried to connect all my screens, etc. Having a lot of fun watching my applications begin to look more than just some kind of Frankenstein monster user interface. Ahahah

Itunes dev videos are great for exploring the theory of UIviews push and pop stack. I found that they were moving a little fast, but watching them, their hands made more sense. I forced myself to look at them all and get a really good idea of โ€‹โ€‹what was going on. Hope a good app comes soon.

+1
source share

All Articles