IB Plugin Container View and child management
IB Plugin Container View and child management
- Subject: IB Plugin Container View and child management
- From: Patrick Mau <email@hidden>
- Date: Mon, 03 May 2010 14:33:57 +0200
Dear list members
I have created in IB Plugin based on the Xcode template and everything works fine.
If you need the completly boring source to help me out I can upload the full project somewhere.
Here's what I'd like to accomplish:
I have a custom NSView subclass that is configured to be a container for other objects.
Exposing child objects using "- (NSArray *)ibDefaultChildren" works as expected.
Now I want to be able to drag other Library Objects from my IBPlugin inside the container but limiting
the objects to certain classes.
How does IB determine the possible drop locations for dragged library objects?
I have implemented:
- (void)ibDidAddToDesignableDocument:(IBDocument *)document
{
NSObject *parent;
parent = [document parentOfObject:self];
NSLog(@"ibDidAddToDesignableDocument: %@", document);
NSLog(@" parent: %@", parent);
// Try to remove ourself when added to the wrong parent
if ([parent isKindOfClass:[self class]] == NO) {
[document removeObject:self];
NSLog(@" removed");
}
}
I assumed (wrongly) that I might be able to check the parent object and remove the
just-added instance, but that leads to a nice "assertion failure" in IB.
Is there any way for a object to refuse itself to be dropped in certain locations?
Thanks a lot
Patrick
_______________________________________________
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