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 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 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can't, the descriminator column can't be used as part… May 17, 2026 at 1:50 am
  • Editorial Team
    Editorial Team added an answer There's documentation and brief descriptions here - are these the… May 17, 2026 at 1:50 am
  • Editorial Team
    Editorial Team added an answer Here's one way to count the integers. public class IntCount… May 17, 2026 at 1:50 am

Trending Tags

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

Top Members

Related Questions

I have a loading overlay which is supposed to block all the AppKit Controls
I would to use the NSSpeechRecognition but this Appkit Framework was not available in
I have an NSControl subclass (which is configured as a layer-hosting view, although I
I have an NSCell subclass that I do all kinds of custom drawing in.
I have a Cocoa app that uses otool to find required shared libraries that
I have written a simple Cocoa app. In Activity Monitor, it is shown to
I have some experience of Objective-C/Cocoa programming on Mac and I'd like to start
I have some submenu inserted as Window item submenu of Main Menu I have
I'd like to have a view that looks more or less like the message
i'm porting an iphone app to Mac app,there i have to change all the

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.