0

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.

4

2 回答 2

2

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

于 2017-01-09T19:04:47.653 回答
0

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].
于 2013-03-30T17:15:53.610 回答