Re: NSTreeController and object retain counts
Re: NSTreeController and object retain counts
- Subject: Re: NSTreeController and object retain counts
- From: Mads Paulin <email@hidden>
- Date: Mon, 9 Nov 2009 07:00:47 +0100
Hi,
will do.. not much to it though:
The document class header:
#import <Cocoa/Cocoa.h>
@interface MyDocument : NSDocument
{
NSMutableArray *array;
}
@property (readonly) NSMutableArray* array;
@end
All I changed in the doc impl is
@synthesize array
and
array =[ [NSMutableArray]alloc init]; in the init method.
The simple node class:
#import <Cocoa/Cocoa.h>
@interface Node : NSObject {
NSString* string;
}
-(NSMutableArray*)children;
@end
#import "Node.h"
@implementation Node
-(NSMutableArray*)children
{
return [NSMutableArray array];
}
-(id)init
{
self = [super init];
if(self)
{
string =@"This is a node";
}
return self;
}
-(void)dealloc
{
NSLog(@"Deallocating Node");
[string release];
[super dealloc];
}
-(id)retain
{
[super retain];
NSLog(@"Retaining with count = %d", [self retainCount]);
return self;
}
-(oneway void)release
{
NSLog(@"Releasing to count = %d", [self retainCount]-1);
[super release];
}
@end
Everything else is hokked up via IB and bindings. An NSTreeController
controls Node-objects in the documents array member and displays them
in a one-column NSOutlineView.
Thank you,
Mads
On Nov 8, 2009, at 21:51 , Greg Guerin wrote:
Mads Paulin wrote:
... big description ...
Can't debug descriptions. Post your code.
-- GG
_______________________________________________
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