• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Retain cycles with NIB instantiations, bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retain cycles with NIB instantiations, bindings


  • Subject: Re: Retain cycles with NIB instantiations, bindings
  • From: Ken Thomases <email@hidden>
  • Date: Sun, 12 Jul 2009 03:40:06 -0500

On Jul 10, 2009, at 2:19 AM, Half Activist wrote:

I'm loading a NIB file at runtime and use a new instance of a class as its owner each time.
Everything works fine, until I wish to delete an object.

In my software, i'm using several instances of objects that have their own UI but are all part of kind of "project", a controller/ manager entity.
So each time I create a new "backend" object, I tie an UI to it, loaded with a NIB file and use bindings to the object to handle UI updates.
Now when I delete the object from my controller, it doesn't get dealloc'd since the bindings in the NIB retain it.

Do you know of a way to proceed other than creating a notification/ callback trigerred at the deletion of the object from the "manager" that would destroy the UI and therefore break this retain loop?

The File's Owner for nibs which contains windows or views should be derived from NSWindowController or NSViewController. Those classes have mechanism to break the retain cycles.


Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Retain cycles with NIB instantiations, bindings (From: Half Activist <email@hidden>)

  • Prev by Date: Re: Best 'Cocoa' File Preview
  • Next by Date: How to prevent NSTableView from reordering rows when clicking at a header cell?
  • Previous by thread: Retain cycles with NIB instantiations, bindings
  • Next by thread: NSCondition (unlocked when not locked)
  • Index(es):
    • Date
    • Thread