How does one add additional items to NSMenu in Interface Builder? - xcode

I'm using Xcode for the first time. I've been following a tutorial, and I'm completely stumped by something that's surely trivial. I've dragged a "Menu" from the Library into my "MainMenu.xib" window. Double-clicking this menu makes it appear.
No trouble thus far. Editing the three items is intuitive, as is deleting items. How on earth do I add an item to this menu, though?

You want to drag an NSMenuItem from the library palette onto the menu:
You can add submenus and separators similarly.

Cmd-D duplicates anything as well if you are getting tired of the drag-drop thing.
You just have to watch out that as your tags and action connections are getting duplicated too they might not be connected to the thing you wanted them to be.

Related

How to make a NSToolbar item toggle state

I have an NSToolbar with NSToolbarItem instances. One of the toolbar buttons is in one of two modes, depending on whether it currently operating (has been clicked) or not. I am handling this in code by changing the icon for the button to have a background rectangle when the command it represents is operational, but I can't help thinking there must be another way.
I've tried using the Selectable checkbox in XCode Interface Builder attribute inspector, and it sort of gives the result I want, except when it is selected I can't click any of the other toolbar items. I also can't see how to deselect it.
I'm a bit of a Cocoa noob so I expect the two state toggle thing is just waiting for me to find it, except so far I haven't been able to.
This seems like it would be a common thing to want to do, thing is how?

Hide objects in storyboard?

I have some UIviews with several Pickers. These pickers is shown when needed. I would like to hide them in Storyboard so I can work with the underlying view without having to move them around each time. Possible?
Mark the view as not installed
The compiler will throw warnings but thats helpful in this case.
A cool shortcut is to CMD-CTRL-SHIFT click the element which will give you a selectable list of the hierarchy at that point

IOS/Xcode: storyboard screen turning black

I am just learning Xcode. I did something that caused a view controller to turn black below the navigation bar when you build app.
It looks white in storyboard.
Also, when I pull a label onto the storyboard, it aligns to the left margin and does not show the drag boxes around it.
I may have inadvertently clicked something but when I compared it in attributes and identity inspectors line by line to another project, nothing seems amiss, i.e. everything is the default value.
Has anyone run across this?
There is not code in associated class that would cause this as it is generic i.e. plain vanilla.
Would appreciate any suggestions. Thx.
With that little information i'd say you removed the root view of the controller?
Either way, you say there is no code, so I'd suggest you simply delete that controller and create another one (bottom right, objects, viewcontroller). Since it's empty you're not gonna lose any data or time :)
Then link it to your class in the Identity Inspector and you're good to go as if it was a new one.

Rearrange Tab Bar items not working as expected

Following on from this question, I have so far been unable to rearrange tab bar items in my iPad app.
I have zoomed in as far as I can go and double-clicked the tab bar controller so that it is highlighted in the Document Outline inspector.
I then try to click-drag individual items left or right but nothing happens, i.e. I'm unable to select them.
Following the comments on the other question, I've tried clicking on another .h or .m file, then switching back to the Storyboard. I've also tried closing x-code and restarting but neither made any difference.
Can anyone tell me what I'm doing wrong?
In the end I took the brute force approach of deleting the segues then reconnecting in the preferred order.
Not particularly elegant but it did the job.

How would one implement a sidebar similar to Mail/iTunes/Finder/etc in Cocoa/IB?

I think the title pretty much says it all... I'm looking to implement an interface similar to the standard OS X sidebar used in all the above mentioned programs, and I'm wondering if anybody has any thoughts as to the easiest way to do it, namely about what view to use for the left hand selection pane. Really I don't think I even need the hierarchical component as seen in the apple apps, I just need a good looking flat list of choices which determine what's shown in the right hand pane.
The obvious start is a vertical split layout view, but beyond that I'm not entirely sure where to go. A collection view with only one column or something like that?
I've done a few applications that use a similar setup.
I generally use an NSSplitView, with a single column NSTableView in the left pane. Don't forget to disable the headers, and make it display as a "Source View" style.
If you want the disclosure triangles, then you'll want to use NSOutlineView instead of NSTableView, but at least for the first go, I'd stick to a simple NSTableView.
A pattern I also use is to make the NSTableView slightly shorter than the NSSplitView, and have buttons at the bottom (add, delete, etc). I've usually built the program around Core Data, so it's easy to hook up these to methods to create/delete objects, and then bind the NSTableView to the array of objects.
Direct support for this sort of thing was added in Leopard. It's called a 'source list'.
Please see the AppKit release notes. Search for NSTableViewSelectionHighlightStyleSourceList in the document.
Or, drag out a table view and select Highlight: Source List in Interface Builder.

Resources