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

  • SEARCH
  • Home
  • 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 719545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:39:16+00:00 2026-05-14T05:39:16+00:00

In AppKit we have representedObject available through NSViewController , this representedObject is generally set

  • 0

In AppKit we have “representedObject” available through NSViewController, this representedObject is generally set to ModelController or the model which the NSViewController displays, this works great with bindings as you just set the new representedObject and model details are updated in the view, BUT in case of iPhone (UIKit, with NO Cocoa bindings available), there is no such representedObject in UIViewController so here are few things I am interested in knowing:-

  1. What is the best/recommended way of binding the model to the UIViewController?, preferably dont want to maintain lot of IBOutlets and calls setters to updated the changed model data for display in view.
  2. How/When should the related model of the UIViewController be released?
  3. When is the -[UIViewController dealloc] called, in the typical iPhone application.

Am looking for architecting some classes so that the UIViewController coordinates between the view and the model, but at the same time, deallocs the model when ever not necessary.

TIA.

  • 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-14T05:39:17+00:00Added an answer on May 14, 2026 at 5:39 am

    That’s the big problem with Cocoa bindings, it hides a lot of things that are very easy.

    dealloc is called when the retain count reaches 0. For a view controller that will happen when other controllers have released it and it doesn’t have any other retains. You shouldn’t worry about this if you are doing memory management according to the rules.

    Create a property for your model object, or model controller if you want to go to that level of abstraction. Using the property correctly (like always using self.model for receiving assignments), and release the object in your dealloc implementation, and set it to nil in viewWillUnload. Properties create the accessors for you.

    As for releasing your model when not required, the above will handle that for you – there’s no need to overthink it. If you are creating massive data structures, then you can consider building them in viewWillAppear and tearing down in viewWillDisappear in addition to the above.

    You will need more outlets and glue code than you would with bindings; but you’ll have to write a lot less code to manage your bindings. Remember that iPhone is supposed to be a less powerful device, and you are supposed to take greater care of resources – and the UIViewController api gives you the opportunities to do that.

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

Sidebar

Ask A Question

Stats

  • Questions 357k
  • Answers 357k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The other answers are correct. Here is some code you… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer you ruin the noConflict concept by reassigning the jquery to… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer If you get that particular error, you don't actually have… May 14, 2026 at 9:40 am

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.