• 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
Crash With Toolbar Items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Crash With Toolbar Items


  • Subject: Crash With Toolbar Items
  • From: Seth Willits <email@hidden>
  • Date: Thu, 31 Jul 2003 12:21:55 -0700

I setup a window controller subclass and used the code below to setup a very basic toolbar but when I run the application, the window shows, I see the customize toolbar item in the window and about half a second later the app crashes. I'm not sure what's causing it to crash, but if I don't call setupToolbar it doesn't crash. I've stepped through with the debugger and it doesn't crash in this code but somewhere in NSWindowController showWindow.


- (void)windowDidLoad
{
[self setupToolbar];
}

- (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:@"mainToolbar"];
[toolbar autorelease];
[toolbar setDelegate:self];
[toolbar setAllowsUserCustomization:YES];
[toolbar setAutosavesConfiguration:YES];
[[self window] setToolbar:[toolbar autorelease]];
}



Seth Willits
------------------------------------------------------------------------ ---
President and Head Developer of Freak Software - http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine - http://www.rbdeveloper.com
Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames

"Few are those who see with their own eyes and feel with their own hearts."
-- Albert Einstein
------------------------------------------------------------------------ ---
_______________________________________________
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: Crash With Toolbar Items
      • From: Stéphane Sudre <email@hidden>
    • Re: Crash With Toolbar Items
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: table with non-textual cells
  • Next by Date: Re: Using HTTPS in Cocoa/Java ?
  • Previous by thread: Re: table with non-textual cells
  • Next by thread: Re: Crash With Toolbar Items
  • Index(es):
    • Date
    • Thread