Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MrFusion

macrumors 6502a
Original poster
Jun 8, 2005
613
0
West-Europe
Hi everyone

My subclass of NSTreeController has a delegate, which can be set in IB. If no delegate is set, my subclass should act as the delegate. So I have to do this before awakeFromNib is called, which means in the init method of my subclass.

However, init and initWithContent are never called. I have no idea why. Some init method should be the first method that is called.

The content is provided by coredata.

Code:
@synthesize delegate;

-(void) setDelegate:(id) value {
	if (!value)
		delegate = self;
	delegate = value;
}

-(id) initWithContent:(id)content { printf("initwithcontent");
	self = [super initWithContent:content];
	if (self != nil) {
		delegate = self;
	}
	return self;
}

Thanks
 
Objects instantiated in Interface Builder are initialized at runtime using -initWithCoder:, not any arbitrary initializer you might have defined.
 
Objects instantiated in Interface Builder are initialized at runtime using -initWithCoder:, not any arbitrary initializer you might have defined.

Ok thanks. BTW, "initWithContent" is specified in the API for NSTreeController.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.