How to customize the segue animation to show an NSWindowController? - objective-c

I am attempting to create a preferences window using a storyboard, as was briefly demonstrated in WWDC 2014 Session 212 - Storyboards and Controllers on OS X. I have a "Preferences…" menu item that should show the preferences window when clicked. In Interface Builder, I connected the action segue for the preferences menu item to the preferences window controller. When I select the "Modal" style for the storyboard segue, then the preferences window is shown when the preferences menu item is clicked, but it is animated into view.
I would like the preferences window to be shown without any animation, like what happens when you open Xcode > Preferences or Safari > Preferences.
I have tried creating a custom NSStoryboardSegue and overriding the perform method in two different ways:
Call the showWindow: method of the destinationController (the NSWindowController).
This does not show the preferences window.
Actually, the window briefly flashes on screen behind all of the other windows, and then disappears.
Call the makeKeyAndOrderFront: method on the storyboard segue's window.
The window starts to appear, but disappears soon after. It seems that the window is being animated into view, but the window is abruptly hidden at the end of the animation.
How do I customize the segue to show the window without animating?

Related

OSX status bar menu occasionally not dismising other status bar menus

So I have a status bar app that launches a small popover in the form of an NSPanel that has transient behaviour. However occasionally if I open say the Dropbox popover and then open my apps popover the dropbox menu will not disappear until I click a button in my popover. Which is strange because it only happens sometimes, and I am using [window makeKeyAndOrderFront:self]; when opening the popover. It works with Skypes drop down menu as well as a host of other status bar applications. There are a couple that won't dismiss when I open mine until I make an interaction in my popover. Is there a way to set focus to that button or something in the panel that might help force the other menus to close all the time?

Make an NSToolbar's fullScreenAccessoryView visible at launch

I am trying to make an application with a toolbar controller which view is shown, and for each view shown I want to include a second 'row' for the toolbar, and I found out that to do this you had to do [toolbar setFullScreenAccessoryView:view]. However, the view does not appear until the user toggles fullscreen mode and the accessory view remains after toggling the window back to windowed mode. I would like it to look like the following examples from Mail.app, Preview.app, Dictionary.app:
just place a custom view underneath the NSToolbarView .. so at the top of the window.
dont misuse the fullscreenAccessory view. it if meant for something else.
see How to create a toolbar with "Search" Finder style, rounded buttons working like radio
(it could be any other view too btw :D)

Displaying Tabview instead of Menu in Menubar App

I am new to OSX App development and finds things a little different from that of iOS. I am trying to create a sample Menubar App. I can display a menu using the command
[statusItem setMenu: startMenu];
But i dont know how can i display a TabView instead of menu. Can some body help me with this.
where statusMenu is an outlet of NSMenu and statusitem is an object of NSStatusItem
You cant. You have to display it in a window, which you can open on the click of the status item.
You can make the window borderless.
1.
You can either use this one here, which is a NSTableView in a window, which can fake the layout of a NSMenu:
JGMenuWindow
Though I would not recommend that, because if Mac OS X has some layout changes, this will stay the same.
2.
Or you can use a normal window, which you customise, like here:
Popup
You can set the custom view of a NSMenuItem, so you could just try adding your tableview to the NSMenuItem of choice.

Re-create Cocoa application menubar

I'm making a statusbar application and load a new xib containing the main window for the application when clicking on a statusbar menu item. However, in the process I deleted the application menu bar. I don't see a way to hook up the NSMenu object I created in the interface builder.
The window loads just fine, and the status bar icon is still present, but when I make the main window the key window, the application menu bar doesn't change, it just shows the previous app that was active.
I have followed the instructions/suggestions here and here, but neither of them work. Is there some other step I've missed?
Thanks!
The behavior you're describing is normal for background applications. If you don't have an icon in the Dock, you don't get your own menubar, even if you have a window in the foreground.

NSToolbar in the NSPreferencePane

I'm trying to implement my app's settings. So I implement Preference Pane but I need to insert Toolbar to it. That is how looks my IB:
And this is how looks my pane from System Preferences:
You see, my window new height = old height - toolbar height. This is my first time I work with toolbar and prefpane, can you answer is there any restriction to use toolbar iside of prefpane?
The System Preferences application already sets a window toolbar so you cannot have a toolbar in your preferences pane.
I recommend using tabs; look at the NSTabView and NSTabViewItem classes.
Note that NSTabView does not actually require tabs to be displayed (though I recommend making tabs visible to the user). You can configure NSTabView to have no tab frame and still take advantage of it for panel-swapping.