I am trying to add a functionality to my status bar app for Mac OS X. I would like to be able to move my item along the bar, as you can do for the native OS tools like the Bluetooth or the WiFi icon.
Cheers
Update for macOS Sierra: Apple improved NSStatusItem. Items can now be reordered by ⌘-dragging. This works for all Apple’s menu items and all third party apps.
Pretty much all the reasons you could ever want to use NSMenuExtra have been removed now, which is great. So, the answer now is to just use NSStatusItem. No further action is required.
What you are looking for is NSMenuExtra and not NSMenuItem.
Apple uses NSMenuExtra for the system menu icons including Wi-Fi and Bluetooth. Although it looks similar to the regular NSMenuItem, NSMenuExtra has some special features, notably to keep their relative order after rebooting, and Command-Draggable by user.
Unfortunately, NSMenuExtra is totally undocumented, so if you are targeting the Mac App Store, it's better for you to stick with the standard NSMenuItem. Otherwise, there is a bunch of tutorials about how to create an NSMenuExtra. For example, here are two of them:
NSMenuExtra – working with undocumented APIs
Building NSMenuExtra - A Small Tutorial
Unfortunately there is no 'good' way to do that, however you can check this question for the hack which can do that:
How to drag NSStatusItems
Related
I want to unify multiple windows from my OS X-Application into a Tab-View, just like Safari, Espresso, Finder, CodeRunner… I found PSMTabBarControl which does the job, but the look and feel are quite different from the other applications I saw.
Comparison (Image)
Then I found out, that those applications had always the same name for the resources used for the Tabs.
Screenshot of the recourses from CodeRunner
Could I just «steal» those images and use them in my own application with PSMTabBarControl or is there another way to get a more native look (not like the PSMTabBarControl default or Chromium Tabs).
You may want to try MMTabBarView.
MMTabBarView is a modernized and view based re-write of PSMTabBarControl.
I release a open source TabbarView controls for OS X and Cocoa recently, you may want to have a look at it here.
I just started Mac OS X programming and I want to build a UI similar to the Pocket Mac Client.
I started with a SourceList, yet it did not work, regarding the table scrolling. Then I found an NSSplitView, yet it looks quite different (see the second screenshot).
I searched through cocoa controls and some other online repositories for a similar ui and could not find some.
Here is my app test (a table in a NSSplitView). It will work, yet looks quite ugly if I add contents ...
Does somebody have an idea on how to gain a similar look to the pocket UI?
you can you use this source for putting buttons on title bar:
https://www.cocoacontrols.com/controls/ansegmentedcontrol
and for the list you should use NSTableView and View Based stye for Content Mode that active by double slow click on table view, for more info:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTableView_Class/Reference/Reference.html
Is there any way to provide custom icons for each NSUserNotification, instead of the default app logo? Like the iconData parameter in Growl.
I want to show "Someone has just posted something" with the photo of this "someone".
You still cannot change the (default) image showing your app's icon, but starting in OS X Mavericks you can in addition display an additional image using the new property contentImage, e.g. like this:
This new property isn't documented in the NSUserNotification class reference, but mentioned in the Foundation Release Notes for OS X 10.9.
Currently not (Mountain Lion). You should post a feature request.
I know this question has been dead for 5 years, but in case someone finds that question and is still looking for a solution, there is that one:
https://github.com/indragiek/NSUserNotificationPrivate
I've tested it in macOS Sierra and it still works. Just be warned, quoting the project creator:
This should go without saying, but using any of this will result in
your app being rejected from the MAS (Mac Apple Store) and potentially breaking if the
APIs change.
Looking for a related answer about NSUserNotifications I found your question. Officially it's not yet supported. But I wrote a little custom control you can use that may fit your needs. Take a look on this Github repository.
I want to add a feature to my Mac app inspired by the Help mode in iPhoto for iPad, pictured below. I would love to do this using built-in APIs, so I don't have to build my own tool-tip-like view. Is there any way for me to either show multiple tool tips at the same time, or to achieve something similar using NSHelpManager?
If you are targeting 10.7 or later you could do this fairly easily using NSPopover. You would have to create quite a few popover windows but it isn't difficult to do.
I need to build an app such as "Messages" in iPhone, but easier (don't need to send messages to server, only in datebase). I was faced with some questions.
http://www.ibm.com/developerworks/library/x-ioschat/index.html
In this tutorial messages look like TableView, how can I do them such as in iPhone standard messanger (comics speach). And how can I implement bar with camera button, text box and send button (what class is responsible for this)?
You are in luck good sir, there is already a class that can fix you up with this and avoid all the work, it's called AcaniChat (screenshot provided). Or you can even see at Sam Soffle's SSMessagesViewController, he is a well known iOS developer who built this class.
It will definitely help you, if you want to mimic that behavior.