I'm learning iPhone/iPad programming. I believe I understand the concept of MVC; what I'm having difficulty with is understanding how some of the files in a normal iPhone/iPad application fit into MVC.
When you create a new application using the "View-Based Application" template an AppDelegate.m and AppDelegate.h file is created.
Is that a Model, View, or Controller file? I'm guessing it's actually none of those. I wish I could see a diagram or a process flowchart that shows what category each file in the application falls into.
Not every file will fit a particular category, however, I would have to say in this instance the AppDelegate is a controller, it doesn't visually present data (a view) nor does it represent the actual data (a model) but it does determine what view controllers to show etc and manage other views (status bar etc) at the start of the application.
I wouldn't worry too much about trying to classify every file into MVC, some just won't fit perfectly, if at all.
The application delegate is a controller object. By default, it is the owner and controller of the main window -- which is a view -- in an iOS app. The app delegate receives messages from an object representing -- or modeling -- the application itself (an instance of UIApplication
). It mediates between the application object, which is the contact point between the app and the system, and the display of the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With