Re: Adding tabs programaticaly (solved)?
Re: Adding tabs programaticaly (solved)?
- Subject: Re: Adding tabs programaticaly (solved)?
- From: Vyacheslav Karamov <email@hidden>
- Date: Tue, 22 Mar 2011 10:16:58 +0200
21-Mar-11 16:08, Vyacheslav Karamov пишет:
Hi All!
I'm writing IB 3.2 plug-in for NSTabView descendant.
After adding new tab
CLTabViewItem * item = [[CLTabViewItem alloc] init];
[item setLabel: @"new Item"];
[tabView addTabViewItem: item];
I'm trying to select it and edit is properties. But IB crashes with
error messages.
2011-03-21 15:44:35.899 Interface Builder[2398:a0f] Message:
ibObjectAtLocation: asked to object not in the document
2011-03-21 15:45:23.413 Interface Builder[2398:a0f] Assertion Failure:
[[controller document] containsObject:self]
2011-03-21 15:45:23.414 Interface Builder[2398:a0f] File:
/SourceCache/InterfaceBuilder/InterfaceBuilder-851/Framework/PublicCategories/IBObjectIntegration.m
2011-03-21 15:45:23.414 Interface Builder[2398:a0f] Line: 213
2011-03-21 15:45:23.430 Interface Builder[2398:a0f] Backtrace:
0 InterfaceBuilderKit 0x0011f909
-[NSView(IBViewIntegration) ibObjectAtLocation:inWindowController:] +
1017
1 CocoaPlugin 0x1283b758
IBShouldSubstituteSwapperForObjectInContextOfArchiver + 48132
2 InterfaceBuilderKit 0x0011f848
-[NSView(IBViewIntegration) ibObjectAtLocation:inWindowController:] + 824
3 InterfaceBuilderKit 0x0011e00d
-[NSObject(IBFrameworkObjectIntegration)
ibObjectAtLocation:inWindowController:] + 708
4 InterfaceBuilderKit 0x001b2867
-[IBViewEditorWindowController objectAtPoint:] + 79
5 InterfaceBuilderKit 0x00122c07
-[IBViewEditorWindowController trackMeasurementsWithEvent:atPoint:] + 58
6 InterfaceBuilderKit 0x0011629c
-[IBViewEditorWindowController interceptEvent:] + 289
7 InterfaceBuilderKit 0x00116140 -[IBEditableWindow
sendEvent:] + 70
8 AppKit 0x91a2352b -[NSApplication
sendEvent:] + 5683
9 Interface Builder 0x00004615
10 AppKit 0x919b72a7 -[NSApplication run] +
917
11 AppKit 0x919af2d9 NSApplicationMain + 574
12 Interface Builder 0x000022c5
13 Interface Builder 0x00000003
What I did wrong?
_______________________________________________
Solution wasn't obvious:
@implementation CLTabView (InspectorIntegration)
- (void)addObject:(id)object toParent:(id)parent
{
IBDocument * document = [IBDocument documentForObject:parent];
[document addObject:object toParent:parent];
}
...
@end
@implementation CLTabView
- (void)addTabViewItem:(CLTabViewItem *)tabViewItem
{
[super addTabViewItem: tabViewItem];
[self addObject:tabViewItem toParent:self];
[self addObject:[tabViewItem view] toParent:tabViewItem];
}
...
@end
_______________________________________________
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