Custom icon for each NSUserNotification? - objective-c

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.

Related

Migrate app to ios11 for Iphone X

I need to update my app and make it look good on the iphone X. I've seen a couple of answers on stackoverflow and on the internet regarding the new safe area option (Use Safe Area Layout Guides).
According to what I've read the app should adapt automatically using autolayout as well but what I've got is this:
If I start a new project it all works fine. The project is quite big, so starting all over again is not an option. What should I do?
Thanks
I just had the same problem, and in my case, the problem was that my app didn't have a Launch Screen.storyboard, it was using a image as launcher. So adding a new Launch Screen.storyboard and selecting that one fixed it, maybe the rest of the app takes some settings from that Launch Screen.storyboard

NSStatusItem reordering along Status Bar

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

Better PSMTabBarControl / Cocoa Tabs

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.

How to add badges to a source list?

I just wanted to know how to to implement badges like in the mail app from osx to my application without using PxSourceList : http://grab.by/nJ66
My app is developed with rubymotion for os x.
Thanks in advance.
As far as I know they are not available "out of the box"... PXSourceList has the best implementation of badges I have seen. Either use PXSourceList or look at the source code for it and be inspired to how it should be done.

How to create transparent notification window?

I'm not sure of the correct name, but I am wondering how to create (in Objective-C) a transparent notification "window/panel", such as is shown when you change the volume intensity, or keyboard illumination, or display brightness. I want to put my own icon/text on it, for my own notification.
I don't know the words to Google for, so I'm asking here.
Thanks for any suggestions.
Matt Gemmell's RoundedFloatingPanel component on his sample code page may do just what you're looking for.
After looking into using the solutions provided by the other two given answers, I found that they would not work for my purposes. So, I wrote up my own library:
BHBezelNotification
Growl is a widely-used implementation of this. By default, it doesn't look exactly like the system overlays, though it is skinnable - you probably want the Bezel notification:
See the Growl Developer Documentation for more.