Reactivate my app from the status bar icon - objective-c

I'm building a Mac app that has no dock icon, but a status bar icon, so the only way of bringing it is from the status icon.
When the app is active i can bring my NSWindow on screen from the status icon without problems. The problem appears when the app looses focus, at that point the app hides itself. I don't know how to make the app again active when i click the status icon.
Thanks.

Have you tried NSApplication's activateIgnoringOtherApps:?
[NSApp activateIgnoringOtherApps:YES];

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?

Native mail composer has normal status bar in iPhone but mostly blank in iPad

I'm using a UIDocumentInteractionController in my universal app. On an iPhone, when a user is presented with the interaction controller and they select the "Mail" option, a native Mail composer window is presented that still shows the full status bar (carrier, the time and the battery life indicator). When the same code executes on the iPad version, the native Mail composer window slides up and then right when it reaches the top, the status bar goes completely black except for the green bar that is normally inside the battery.
Is there anything I can do to control the appearance of the status bar when the native mail composer window opens?
Here you can change your status bar style in you App info, Hope it will help for you.

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.

Hide app icon in dock when minimized

I am new at Mac OSx development.
The app that I am creating requires removing the app icon from the dock throughout the application. The app allows minimizing and closing of the app window. Relaunching or reopening of the closed or minimized app window is done by clicking the app's icon from the status bar.
I was able to set the dock icon to be disabled during app launching; however, when the app is minimized (clicking the minimize button), it captures the image of the app's current window and adds it to the dock. I don't want that to occur. The app should not add any item to the dock.
Questions:
Does Apple allow removal of the app's re-launcher image from the dock when minimized?
If Apple allows this, how can I hide or remove the app from the dock?
Any help would be a big help! Thanks!
You cannot disable the display of a proxy tile when your window is minimized -- that's the primary way that users will restore a minimized window. If you'd rather that the window disappear entirely when it's not being used, disable minimization (in the window's flags) and have the user close the window instead.

Custom behavior when clicking application icon in the Mac OS X dock

I am trying to modify the default behavior when clicking the icon of a running application in the dock. By default it brings the main window of the application to the foreground.
I would like to perform a custom operation when the icon is clicked.
Any idea to achieve this?
Implement applicationShouldHandleReopen:hasVisibleWindows: in the app delegate; see the explanation there.