agg23
agg23

Reputation: 81

Custom System Notification, Similar to the Volume Notification

How would you go about creating a popup system notification in OS X, just like the volume notification. Xcode also shows one of these notifications when it completes a build.

You can see what I mean here.

I would prefer to use a built in API call (which I would assume exists somewhere) over building it myself.

Upvotes: 0

Views: 409

Answers (2)

Rock_Artist
Rock_Artist

Reputation: 745

Seems like there's some fork of MBProgressHUD with macOS in mind: https://github.com/Foxnolds/MBProgressHUD-OSX

Upvotes: 2

indragie
indragie

Reputation: 18132

There are many open source projects that implement HUD notification views. Two notable projects are MBProgressHUD and SVProgressHUD. Either of them should be suitable for your needs.

EDIT for OS X: There are no open source projects that I know of that could be used for this on OS X. However, it would not be difficult to make this yourself. Here are the key details that you need and should get you up and running:

  1. Create a custom borderless, transparent NSWindow as shown here.
  2. Create a custom frame view that draws the rounded transparent black HUD background. You can use NSBezierPath to create a round rectangle drawing path.
  3. Add subviews to the window's content view (e.g. image view to display an icon and a text field to show text underneath it).
  4. You can use the animator proxy to fade this window in and out. e.g. [[window animator] setAlphaValue:1.f].

Upvotes: 0

Related Questions