Note that there are some explanatory texts on larger screens.

plurals
  1. POIBPlugin: Adding additional objects on drag from IB Library
    primarykey
    data
    text
    <p>I have a <strong>list view class</strong> that just like NSCollectionView <strong>requires an additional prototype item and a prototype view</strong> to be of any use. When dropping an NSCollectionView from the library in Interface Builder those two helper items are automatically created. However I couldn't find a single official Apple document dealing with this use case (describing how its done).</p> <p>Digging thru the Apple Dev Guides I could however find "<a href="http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/NSObjectIBAdditions_Reference/Reference/Reference.html" rel="nofollow">ibDidAddToDesignableDocument</a>:".<br> With the following code I managed to get my auxiliary items created on drop from library:</p> <pre><code>- (void)ibDidAddToDesignableDocument:(IBDocument *)document { [super ibDidAddToDesignableDocument:document]; NSView *prototypeView = [[[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 300, 65.0)] autorelease]; DLListViewItem *prototypeViewItem = [[[DLListViewItem alloc] initWithNibName:nil bundle:nil] autorelease]; [document addObject:prototypeViewItem toParent:nil]; [document addObject:prototypeView toParent:nil]; [document connectOutlet:@"view" ofSourceObject:prototypeViewItem toDestinationObject:prototypeView]; [document connectOutlet:@"listView" ofSourceObject:prototypeViewItem toDestinationObject:self]; [document connectOutlet:@"prototypeItem" ofSourceObject:self toDestinationObject:prototypeViewItem]; } </code></pre> <p>However…</p> <p>…<strong>IB adds those aux items</strong> for NSCollectionView <strong>only</strong> on the actual <strong>initial drag from the library</strong>, not on any other call of "ibDidAddToDesignableDocument:", such as when embedding, copying or duplicating the item. (while my method would, and on all) </p> <p>This makes me wonder whether Apple actually uses "ibDidAddToDesignableDocument:" for this and if I'm on the right track with this at all. </p> <p>How does one imitate this properly? I'm having a hard time trying to distinguish between different contexts for "ibDidAddToDesignableDocument:". Anybody successfully done this?<br> Unfortunately none of Google, Google Code, GitHub, or the documentation revealed anything helpful, so I'm in desperate need of help here. :(</p> <p>Thanks in advance!</p> <p>Edit: Oh great, this question just brought me the tumbleweed badge, yay! Not.<br> I'm more into useful answers actually, but thanks anyway ;)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload