IBOutlet inside document based application

101 views Asked by At

I've created an application document based but I had problem to handle IBOutlet becouse when I selected some controller inside the document in the first window sometime the other same controller in another window document was selected too... Maybe I did wrong with strong/weak/readwrite or something I'm not very sure so I've decided to force my application to have just one window document for time. Now my problem. I've an arrayController and when I launch my application and I do open saved file it close the "blank document" created by default and show the new window document with the data loaded. The problem is that the arrayController of the second window called inside the windowControllerDidLoadNib is the right pointer (created by makeWindowControllers) but when I use this inside the code it has another pointer that is the old arrayController of the blank document that is been closed!! Why? Do close method release everything? (I use ARC). Excuse me if my words are confused, I'm newbie. Thank you. This is my code:

Document* newDoc = [[Document alloc] init];
[[NSDocumentController sharedDocumentController]addDocument:newDoc];
[newDoc makeWindowControllers];
[newDoc showWindows];
1

There are 1 answers

0
AudioBubble On BEST ANSWER

I've solved this issue: when you define notification for some object as a nsdocument these are not released after close calls. So you need to remove observer!