dhrm
dhrm

Reputation: 14944

Objective-C: How to create a Menu with custom UI?

I'm trying to develop an application in Xcode 4.1. I would like to create an application located in the menu bar, like described in this tutorial: http://cocoatutorial.grapewave.com/2010/01/creating-a-status-bar-application/

But instead of showing a standard Menu when clicking, I would like to show a more graphical UI with some text fields, buttons, etc. like they do in Fantastical: http://flexibits.com/fantastical

I hope someone can tell me, how I can do.

Upvotes: 0

Views: 1001

Answers (2)

Mike C.
Mike C.

Reputation: 601

It's not necessary to use a custom view. All you have to do is set the status item's target & action to your method which shows the window:

[self.statusItem setTarget:self];
[self.statusItem setAction:@selector(ShowOrHideWindow:)];

Upvotes: 0

rob mayoff
rob mayoff

Reputation: 385970

Here's the Status Bar Programming Topics guide.

  1. Make an NSStatusItem. Set the item's view to a custom view that you create. This view will appear in the status bar and receive mouse clicks.

  2. Make your custom view handle a mouse click by presenting a window with your custom UI.

Upvotes: 2

Related Questions