• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Toolbar woes...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Toolbar woes...
      • From: Bryan Blackburn <email@hidden>
  • Prev by Date: Re: @protocol vs NSClassFromString
  • Next by Date: Re: COCOA: Simplest Way of Formatted Text
  • Previous by thread: Re: @protocol vs NSClassFromString
  • Next by thread: Re: Toolbar woes...
  • Index(es):
    • Date
    • Thread