• 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: NSTreeController and object retain counts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: NSTreeController and object retain counts (From: Greg Guerin <email@hidden>)

  • Prev by Date: iPhone: NSOperation and UITableVIews
  • Next by Date: Re: principle classes from two bundles get confused
  • Previous by thread: Re: NSTreeController and object retain counts
  • Next by thread: Re: NSTreeController and object retain counts
  • Index(es):
    • Date
    • Thread