• 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
Another Bindings problem - sorry!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another Bindings problem - sorry!


  • Subject: Another Bindings problem - sorry!
  • From: Mike Abdullah <email@hidden>
  • Date: Tue, 7 Mar 2006 01:05:29 +0000

Hey, I'm really sorry, but I have another bindings problem. My app has a slightly odd structure:

The document, has a MyMainObject instance in it.
An NSObjectController uses MyMainObject as it's content.

MyObject has an NSArray of the type MyMiniObject as one of its keys
This is managed by an NSArrayController

So, my app quite happily creates and destroys MyMiniObjects in response to buttons in the interface.

However, I have now added a nib file to the project that is owned by MyMiniObject. So every time MyMiniObject is initialized it loads this nib and displays the view from the nib. When deallocing, MyMiniObject releases the view

Now this view contains a text field. I want to bind the value of this text field to a key of MyMiniObject. I have tried doing this by both binding directly to the File's Owner, and by creating an NSObjectController in the nib.

This binding works great until the NSArrayController attempts to release MyMiniObject. MyMiniObject will no longer deallocate because it is being retained by the text field binding. And so, dealloc of MyMiniObject is never called, and so none of the related items are released either!

Does anyone know how to implement this sort of relationship? At the moment the best I can think of is to override release of MyMiniObject. When release is called, I'd check to see what the retain count is, and if it's only 1, I release the binding, thereby deallocing MyMiniObject.

However, to me this seems a bit of an ugly workaround. Is it the only option?

Mike A.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Another Bindings problem - sorry!
      • From: Miguel Sanchez <email@hidden>
  • Prev by Date: RE: retain/release question about Apple docs
  • Next by Date: quit on restart even with sheet?
  • Previous by thread: Re: number Of Bytes left to load in QTMovie
  • Next by thread: Re: Another Bindings problem - sorry!
  • Index(es):
    • Date
    • Thread