5

I'd like to create a toolbar item like the central item seen in Xcode/iTune/Instruments/etc:

central toolbar item

Can anyone tell me what it's called and how to go about creating my own?

Also, will I face problems getting my app approved by Apple when I submit it to the Mac App Store, for imitating Apple's own apps too much?

trojanfoe
  • 120,358
  • 21
  • 212
  • 242

3 Answers3

3

I finally implemented the solution from here:

iTunes or Xcode style information box at top of window

Here are the initial results:

enter image description here

Community
  • 1
  • 1
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
0

I've noticed some interesting things about Instruments:

  • If you make the window narrow such that the overflow menu is triggered, the items in that menu are all blank.
  • You can't change the icon size or turn labels on/off.
  • Colors does not have a label when you add it to the toolbar.
  • The labels on Space, Flexible Space, and Colors do not line up with the other items' labels.

These are interesting because they seem to fit an idea I had for implementing this: turn labels off, and give all your items custom views, where normal-looking items actually have manually drawn labels. It would obviously be a lot of work, but it gives you enough freedom to effectively do full-height items.

The nice thing is that, unlike the view/window hack that Xcode seems to use, you still have a customizable toolbar with draggable items.

Uncommon
  • 3,323
  • 2
  • 18
  • 36
0

This is an Apple's private control, but you cannot create it as a NSToolbarItem. Check this other Q/A to know how to add a custom view in the window's main frame.

Is it possible to draw in the label area of NSToolbar?

Community
  • 1
  • 1
Andrea Cremaschi
  • 533
  • 3
  • 19
  • That isn't true - I've created the control using the answer to this question: http://stackoverflow.com/questions/5951196/itunes-style-box-in-cocoa. I have added it to the toolbar and even got it centred correctly. – trojanfoe Feb 20 '12 at 18:22
  • @trojanfoe: the code snippet at the link you provided doesn't use NSToolbarItem and NSToolbar: it overrides the NSView's drawRect: method to draw a custom box. What I am stating in my answer is that iTunes and Xcode don't use a NSToolbarItem to display their LCDs, as they are drawing in the toolbar item's label area. – Andrea Cremaschi Feb 21 '12 at 14:33
  • Yes apparently they draw *over* the toolbar using separate window. I don't want to do that as it sounds too ugly to me... – trojanfoe Feb 21 '12 at 14:41