• 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
Re: Full-Height Toolbar Item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Full-Height Toolbar Item


  • Subject: Re: Full-Height Toolbar Item
  • From: John Pannell <email@hidden>
  • Date: Fri, 27 Jan 2012 11:07:05 -0700

Hi Mark-

I have an app that has such an appearance…

http://www.positivespinmedia.com/BombSquad/screenshots.html

There's a couple ways to go about it… in a different project, I used NSToolbar, but disabled customization for it and set it to display "Icon-only" (no labels).

[toolbar setAllowsUserCustomization:NO];
[toolbar setDisplayMode:NSToolbarDisplayModeIconOnly];

I then made sure my other "button-like" toolbar elements had labels as part of the view the item presented (all of the toolbar items were containers that were NSView subclasses), and a button sized appropriately.  Looked great, but didn't allow the user to shut off the label display for the buttons, nor did it allow for toolbar customization.

In BombSquad, I had special needs in terms of the layout of the status display: it had to remain centered until the window compressed to a certain point, and then it had to ease the status display over to the left to allow the display and single button to layout in an appealing fashion as the window squished down to min width.  NSToolbar will not provide sufficient control over the centering of the status view, nor will it do custom layout, so I just wrote my own container view to layout the subviews as desired during its own resize.  Once again, no toolbar customization, but this was fine for this case.

If I was doing this for something that is going to look and function like Xcode's toolbar, I would stick with an NSToolbar subclass, use  NSToolbarDisplayModeIconOnly, use container views as toolbar items, and have my container views center layout vertically.  Inside each container view will be the control above the label.  Override setDisplayMode: and when you get a new display mode, leave the toolbar's display mode to NSToolbarDisplayModeIconOnly and show/hide your labels in their container views.

Hope this helps!

John


John Pannell
http://www.positivespinmedia.com


On Jan 26, 2012, at 5:28 PM, Mark Alldritt wrote:

> Hi Everyone,
>
> I'm looking for a way to make a view-based Toolbar Item that occupies the full height of the toolbar (i.e. including the space normally reserved for the toolbar item's label).  Xcode 4 does this for its "status" display, and I have a similar need in my application.  The NSToolbar and NSToolbarItem definitions don't appear to make this possible, but perhaps there is something I've overlooked.
>
> Thanks
> -Mark
>
>


_______________________________________________

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


References: 
 >Full-Height Toolbar Item (From: Mark Alldritt <email@hidden>)

  • Prev by Date: Re: Full-Height Toolbar Item
  • Next by Date: Re: afterDelay not working?
  • Previous by thread: Full-Height Toolbar Item
  • Next by thread: Re: Full-Height Toolbar Item
  • Index(es):
    • Date
    • Thread