Re: NSTreeController - setEntityName only settable once??
Re: NSTreeController - setEntityName only settable once??
- Subject: Re: NSTreeController - setEntityName only settable once??
- From: Andre <email@hidden>
- Date: Sun, 29 Jan 2006 16:12:09 -0800
Scott Anguish wrote:
I think you'd be better off creating the objects yourself and
inserting them into the controller using one of the other methods.
Thanks, this works!
- (IBAction)addAttribute:(id)sender
{
id newAttribute = [[self managedObjectContext]
insertNewEntityWithName:@"Attribute"];
[self insertObject:newAttribute atArrangedObjectIndexPath:[self
selectionIndexPath]];
}
The only problem now, is, how to add children....
This just adds peers...
Any idea?
Thanks very much for your solution!
Andre
On Jan 29, 2006, at 4:42 PM, email@hidden wrote:
Hi List,
I'm trying to insert different objects (but have the same
superclass/entity) in an NSTreeController.
So to do this, I just add a method to the tree controller like
insert<entityName>.
So inserting a "Country" looks like so:
- (IBAction)addCountry:(id)sender
{
[self setEntityName:@"Country"];
[self insert:sender];
}
This works the first time, but other methods such as
- (IBAction)addAttribute:(id)sender
{
[self setEntityName:@"Attribute"];
[self insert:sender];
}
Fail to insert an attribute, it instead is stuck inserting a
Country entity.
Even though [self entityName] returns "Attribute" the
NSTreeController still inserts a "Country" entity!!!
It seems that at runtime, whatever is called first (Attribute or
Country), thats what it always creates, even if - entityName
returns something else....
Bug? Workaround? DTS?
Thanks in advance,
Andre
email@hidden
Andre
email@hidden
_______________________________________________
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
Andre
email@hidden
_______________________________________________
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