Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4049966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:00:41+00:00 2026-05-20T14:00:41+00:00

I need help in understanding MVC model in iPad/iPhone environment. Somehow I can’t understand

  • 0

I need help in understanding MVC model in iPad/iPhone environment. Somehow I can’t understand it even after reading several times.

Let’s say I want to build a small application that store image location, and the comment for each image. I will possibly create a “SZImage” class that store these information. Aside from setter and getter, do I need to implement other methods? What is the role of model, what methods can it implement and what it can’t do?

After that, I will need to setup the interface for displaying image. So I need to create another class with name “SZImageView”. What is the role of this class? Does it draw on the iPhone window or I leave it to the controller to do the job. If I leave to the controller to draw, then why should I create this class?

And if I need to have controller to be the bridge between the model and view, then a class with name “SZImageViewController” should be created. What should this class do?

Last, this is the one that have been confusing me for a long time. How can I use the method in other class to add window to the AppDelegate? How does the interaction between instance within class be done. Because I see that the AppDelegate is usually very short and simple.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:00:41+00:00Added an answer on May 20, 2026 at 2:00 pm

    Model-View-Controller Class Categories and Examples

    In Model-View-Controller (MVC), every class should be designed to fit into one of these three categories. In doing so, you can avoid class coupling and create much more flexible code.

    Model Classes.
    Classes of this category should represent the application’s data model. If the application is a game then classes that represent the player, enemies, level layouts, saved data (such as scoreboards) and so on. But these classes should be restricted only to holding the data that represents these objects and the logic behind them. For example, if it’s a racing game, the class ‘Car’ should be part of the model, and it should represent all the properties of a car (for example it’s speeed, acceleration, turning etc.). This class should also include all the necessary logic for the car, for example logic that determines how the car should move (such as acceleration and breaking, turning), and what should happen in the event of a collison and so on. This ‘Car’ class should note define how the car is presented to the user. Nor should this class involve any application logic. It should stick completely to describing what it is to be a car.

    View Classes.
    Classes of this category should represent the way in which the application presents the model to the user. Keeping with the previous example, examples of classes that fall into this category would be a ‘MainMenu’, ‘ScoreBoardView’, and ‘RenderingEngine’. The ‘MainMenu’ class knows exactly how to display a list of options to the user and how to look really beautiful. It also knows that when one of the options is selected, it should change its visual appearence slightly, such as a button appearing “pushed in”. However, this class doesn’t know what logic to do when a button is pressed. This is the job of the controller classes. So the view classes simply let the relevant controller know that the user interface has been interacted with by the user (by either calling some controller method or sending a notification out). More on this in the controllers section.

    “ScoreboardView” also knows that when it’s passed a dictionary (model class) of strings and numbers (player names and scores) that it is to present them in a particular way, perhaps in a table. It doesn’t know how to update the dictionary, nor how to calculate the average score. If it want’s more information then it needs to ask the controller for it. It’s then the controller’s job to figure out a way of getting the information.

    Finally for this section, a “RenderingEngine” is a view class because it takes a model and produces visuals for it. And that’s it. The RenderingEngine is programmed to know how to display a car, and that if the car is set to be in a particular location then it should be drawn in this location, or if the car has collided then it needs to be drawn with buckling. But again, it doesn’t know how to update the position of the car, nor the speed and so on.

    Controller Classes.
    Finally, and as I’ve already previously slightly alluded to, controllers are the classes that bring everything together, and provide the flow and control for your application. People have refered to the controller classes as the “brains” of the application because they make decisions based on the user’s input (which is channeled through the view classes) and the data model (which is accessible through the model classes).
    The controller classes control the application’s flow. They take the user from the “main menu” to the “car selection screen” to the “race track” to the “race” to the “scoreboard screen” and so on! They make changes to the model through the classes and they provide the feedback of changes to the view classes so as those classes can present the current state of the application to the user. Controllers effectively link the model and the view together, while at the same providing application logic and program workflow. This program workflow can also include handling issues where the input that is taken from the view does not fit correctly with the model. The view has very little knowledge of the model and can’t provide the necessary checks – this is one of the jobs of the controller. For this reason, it’s generally considered bad practice to directly link the view classes with the model classes. Of the three types of classes, the controllers are generally the classes that are the least interchangeable, but in practice it is the view and model classes that you would want to interchange the most.

    Conclusions. The model-view-controller design pattern allows developers to logically organize their work and the components of their applications. When the model-view-controller paradigm is used it maintains flexibility because any of the three components can be replaced, so long as the replacement module keeps to the same protocol that the other two components expect to be able to intereact with. (When I say “protocol”, this can design can either be implemented using inheritence, or for some cases, it’s better to use an actual protocol declaration and ensure that classes confirm to the appropriate protocols.) A perfect example of this is that many applications written for the Mac can easily be moved over to iOS because the only major difference between the two platforms is at the user interface level, which is completely understandable given that the interface for the Mac is traditionally a large screen that the user interacts with via a keyboard and a mouse, on the other hand, the interface for iOS consists of a much smaller screen that the user touches to interactive with.

    Further reading. The wikipedia page (of course!), MVC in the Apple Developer Documentation, ‘Cocoa Design Patterns’ by Erik M. Buck.


    I’ve tried to keep this explanation fairly generic to all platforms, frameworks and languages. In iOS development, the MVC design is considered so paramount that you would have to work very hard against the frameworks to avoid using MVC. There is a clear distinction between the view classes (UIView, UITableView, UIAlertView, UIImageView etc.) and the controller classes (UIViewController, UITableViewController, UINavigationController etc.) and the rest of the model classes (NSString, NSDate, NSManagedObjectContext, UIImage etc.). Every class clearly resides in one of these three categories which allows for code reuse and hugely flexibility as you’re developing your app.

    More specificly relating to your question, your AppDelegate will fall into the controller classes category. It provides the control over the key events of your application. When the application is launched, when it will quit, when it will enter background mode and so on. Your program needs to have a place where the thing to do at these events is handled and this is where it should be implemented.

    I hope this helps. I’d also strongly recommend checking out the free WWDC2010 Session Video on the Model-View-Controller paradigm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need some help understanding how i can create a new custom event. i
I need help understanding some C++ operator overload statements. The class is declared like
I need help with the best practice to localize asp mvc apps, I saw
Need help understanding what I am doing with the syntax here, please help! I
I need help understanding the following. Say I have a display that is 854x480
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need help with this route map routes.MapRoute(Blog_Archive, Blog/Archive/{year}/{month}/{day}, new { controller = Blog,
I need help getting my head around the difference between my current OOP notion
I need help to replace all \n (new line) caracters for in a String,
i need help with disk_total_space function.. i have this on my code <?php $sql=select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.