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 8289309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:28:49+00:00 2026-06-08T12:28:49+00:00

This may be a dumb question, but in MVC the view doesn’t know about

  • 0

This may be a dumb question, but in MVC the view doesn’t know about the model right. I’ve looked at some examples for table view cells, and the table view cell has a property of the model object. It then uses that model’s property to fill in the label, or the image for the cell.

Or in another case, if I have a UIView to draw something dynamically based on the model, it seems like it would be the easiest to have a property on the UIView so the UIView can access that model’s data in order to draw it dynamically. So I could do something like this:

myView.object = newObject;
[myView setNeedsDisplay];

Is this wrong for MVC? If so, what are the better ways to do these two things? Thanks.

  • 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-06-08T12:28:51+00:00Added an answer on June 8, 2026 at 12:28 pm

    Or in another case, if I have a UIView to draw something dynamically
    based on the model, it seems like it would be the easiest to have a
    property on the UIView so the UIView can access that model’s data in
    order to draw it dynamically.

    So what would you have the view say to the model in order to get the right information? It has to know something about the model in order to ask the right question, right? Alternately, you could define a protocol like UITableViewDataSource and send generic messages like -cellForRowAtIndexPath:, and then implement that protocol in your model. That avoids the need for the view to know anything specific about the model, but it means instead that the model now has to know about the view — it has to know something about what’s supposed to be displayed in the view so that it can pass back the right data. Whichever way you go, you introduce a dependency between the model and the view, and that means that when you make a change in one you’ll have to make a change in the other.

    Avoiding those kinds of dependencies is exactly the point of the MVC architecture. The controller knows about both model and view, which allows the model and view to exist independent of each other.

    It might sometimes make sense to have some objects that both model and view know about. If you’re writing an address book, it might make sense to have a ContactView that knows how to display a Contact, and a model that stores Contact objects. That seems much more sensible than having a view that’s completely stupid about what it’s displaying, and it lets you pass around Contact objects instead of great long lists of name, address, phone, fax, email, etc. You could say that a Contact is a model object, and all the above applies: you’ll be introducing a dependency between ContactView and Contact. But usually when we talk about “the model”, we mean the whole graph of objects that the program uses to store its data, and the benefit of MVC is to separate the way you manage all those objects from the way you present the data that they contain.

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

Sidebar

Related Questions

I know this may be a dumb question, but my background is more in
Ok so this may be a dumb question (probably some syntax) but Google didn't
This may seem like a dumb question, but still I don't know the answer.
I know this may sound like a dumb question but I got to know
This may seem like a dumb question but I don't know how to do
This may be a really dumb question but I'm just starting to learn the
This may be a dumb question, I have tried googling but I am probably
This may be a very dumb question but I can't seem to get it
this may be a dumb question, but I can't seem to find the answer.
I feel like this may be a dumb question, but it's late and my

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.