Okay of course i checked the API and there is nothing - at least under this class name.
What i mean is the widget referred to as a bottom bar in the Apple Human Interface Guidline.
Do i have to draw this myself from a NSView, if so how do i get the texture drawn?
alt text http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/AppleHIGuidelines/art/wn_newwindowparts.jpg
P.S.: I added Toolbar to the tags because it is the closest generic keyword i can find and the bottom bar ist just the opposite as a toolbar.
You're looking for the "content border." This is something you need to set in code with Leopard, but you can set it in Interface Builder in Snow Leopard (note you must be targeting 10.6 or above in order for this to be a valid setting in Interface Builder).
You can conveniently set a large or small border (using the standard Apple-approved sizes). To set this, select your window in Interface Builder, then show the Size inspector. At the bottom of the panel, you'll find the Content Border settings.
Brandin Walkin's excellent BWToolkit (BSD license) provides support for UI in the content border (among many other nice UI elements) and makes using a "bottom bar" much more enjoyable.
Related
I'm trying to create an application that would be as standard as possible in terms of style.
An image is worth a thousand words: I can't figure out how to make my buttons the same size as in Apple's programs such as Safari or Finder.
As you can see, the sizing I've set in interface builder don't seem to match the size the buttons get when I run the app, but maybe that part doesn't speak in pixels but in points or something? Also, textured rounded button has only width editable, but not height.
In this case, these are NSButtons, but I guess I'll have a similar problem with other control types...
I found it out! The problem was with neither of these two parts outlined in the screenshot, but in the "Toolbar" item, higher in the hierarchy.
There is a Size attribute in the Attributes inspector which defaults to Small, but you can set it to Regular instead, and then the buttons get the same sizing as in Finder and all.
I have implemented a unified titlebar/toolbar and now would like to add two buttons to the bar. They need to be located at the far left, just right of the stoplight buttons. I'm creating a toolbar that's very similar to System Preferences.
I have looked at the API for adding NSTitlebarAccessoryViewController and the only valid properties for layoutAttribute are NSLayoutAttributeRight (adds the view to the far right of the toolbar) and NSLayoutAttributeBottom which essentially places the view underneath the unified toolbar in its own toolbar.
I want neither of those options, so how would one add a bunch of buttons to the very left of the unified toolbar?
It is actually a lot easier to archive this:
Just add a toolbar to your window using the Interface Builder and set the title visibility to hidden:
[window setTitleVisibility:NSWindowTitleHidden];
This is now possible in OS X 10.11. Quoting from the header file:
For applications linked on Mac OS 10.11 or later, NSLayoutAttributeLeft is also supported; placing the item on the left side of the window (adjacent and to the right of the close/minimize/maximize buttons).
You can use WAYAppStoreWindow on GitHub to do this. I created a fork of the WAYWindow subproject to vertically centre the document title since this wasn't supported.
When editing code, Xcode is capabale of displaying in-text controls, like drop down buttons which can show context menu's. I've seen other OS X apps that handle text capable of similar features. See the attached sample.
I presume this effect is obtained using NSTextAttachmentCell - although I'm not sure whether this is the proper way to implement this.
For my own app I would like to use this technique as well.
I have the following questions:
Is NSTextAttachmentCell the correct way to implement such a feature? If not, what would be?
How do I attach a control -comparable to the one in the above sample- to a specific range of text so that its location within NSTextView is dynamic and follows layout actions?
I found this which gives some hints but does not cover the attachment to specific text ranges.
Although NSTextAttachmentCell will work, it has a disadvantage: the cell will become just a glyph in the text which was not what I wanted. It distorts the layout of the text, is selectable etc. I wanted the cell to be drawn over the text, just like the behaviour in Xcode.
The challenge was to find a way of translating a point from a Mouse Moved event to the position of a particular string of characters inside the NSTextView.
After some more digging I found a little gem in Apple's demo apps called LayoutManagerDemo. This demo shows a custom subclass of NSTextView capable of highlighting individual characters, words and lines while the mouse is hoovering its view. From there on it was pretty easy to fade in a button at the required NSPoint and then show a popup menu with some options.
I've been making iOS apps for awhile, but I'm trying my hand at MacOS development. I'm adding an NSTextField to my UI and I noticed in Xcode that one of the options in the graphical widgets is "NSTextField with NSNumberFormatter" which implies to me that I'll be able to restrict the input of the field to numbers and configure the formatter in some way.
When I add the NSTextField with NSNumberFormatter to my UI, I can see it has a formatter outlet which appears to be kind of linked to an NSNumberFormatter (although the name is a little grayed out). However, I can't figure out any way to interact with or configure that NSNumberFormatter.
Any help?
To access the NSNumberFormatter, you have to select it in the dock (that list of objects on the left side of the XCode 4 Interface Builder [IB] window).
If the dock isn't in outline view, e.g., it just shows about 4 icons, click the triangle-in-a-square-button at the bottom of the dock. The dock should now show a "Placeholders" section and an "Objects" section; the objects are your UI objects in a hierarchical outline view.
In the IB window, click your NSTextField; that'll highlight the corresponding Text Field Cell in the outline (you may have to twiddle down some disclosure triangles to see it). The Text Field Cell should have a disclosure triangle; twiddle it down to reveal the Number Formatter. Select it, and you should now be able to manipulate it in the Inspector panel.
(There are a lot of things non-obvious like that in XCode. When in doubt, examine your UI object in the Dock's outline view, or prowl the menus with that object selected. It's amazing--and often useful--what you can discover lurking there!
to configure the number formatter, you can ( after you've selected the formatter ) open the Attributes inspector, select the behavior you want and customize the formatter. At least that worked for me in XCode 4.
– moritz
Apples Application like Pages and Numbers always show an additional small Toolbar under the main Toolbar. Is there an object like this in the Interface Builder or do I have to build it from scratch?
I looked in the IB Library but found nothing so far.
You use NSSegmentedControl objects to do that, styled to Capsule. To achieve segmented controls with labels aligned underneath (which are clickable, like in Mail.app and Preview.app), you need to put them into toolbar button groups. That can't be done in IB. See this discussion in the Cocoa mailing list:
http://www.cocoabuilder.com/archive/cocoa/204390-capsule-style-toolbar-controls.html
There is no build-in control for that. You can take a look at the BWToolkit from Brandon Walkin. It has a lot of nice controls to build Apple-like applications. Maybe it can fit your needs...
It's just a simple view containing various controls. You could build most of it directly in Interface Builder. Just create an NSBox, give it a background color and then place "Mini"-sized controls in it.