Toolbar woes...
Toolbar woes...
- Subject: Toolbar woes...
- From: Andy Satori <email@hidden>
- Date: Tue, 21 Jan 2003 21:52:32 -0500
After experimenting lightly with toolbars, I don't understand why this
is suddenly problematic, and I'm hoping someone can shed some light.
Using the examples from Mike Beam's articles on macdevcenter I have
implmented a toolbar category on his address book, no problems. Then
when moving this same basic code into an application that was working,
I get a SIGSEGV 11 when I run the application. Commenting out the call
to [self setupToolbar]; eliminates both the toolbar and the SEGV.
Below you will find the relevant ( I think ) code.
Andy
#import "sosxToolbarCategory.h"
@implementation sosxController (ToolbarDelegateCategory)
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar
itemForItemIdentifier:(NSString *)itemIdentifier
willBeInsertedIntoToolbar:(BOOL)flag
{
NSToolbarItem *item = [[NSToolbarItem alloc]
initWithItemIdentifier:itemIdentifier];
return [item autorelease];
}
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar
{
return [NSArray arrayWithObjects:NSToolbarSeparatorItemIdentifier,
NSToolbarSpaceItemIdentifier,
NSToolbarFlexibleSpaceItemIdentifier,
NSToolbarCustomizeToolbarItemIdentifier, nil];
}
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar
{
return [NSArray
arrayWithObjects:NSToolbarFlexibleSpaceItemIdentifier,
NSToolbarCustomizeToolbarItemIdentifier, nil];
}
- (void)setupToolbar
{
NSToolbar *toolbar = [[NSToolbar alloc]
initWithIdentifier:@"toolbarExplorer"];
[toolbar autorelease];
[toolbar setDelegate:self];
[toolbar setAllowsUserCustomization:YES];
[toolbar setAutosavesConfiguration:YES];
[windowExplorer setToolbar:[toolbar autorelease]];
}
@end
and
- (void)awakeFromNib
{
...
[self setupToolbar];
}
in the controller.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.