Skip navigation.
 
mlhow do i get a badged app icon?
FROM : Ken Victor
DATE : Sun Oct 17 01:22:00 2004

under some circumstances, i need to display an app modal critical
alert. this alert needs to have more than just a title and a message
as it needs to include a picture.

currently, i have this working as described below, but it seems to me
that there is probably a much more direct and better approach.

current approach"
using IB, i've defined a nib file that among other views, contains an
NSImageView currently set to hold NSApplicationIcon.

when needed, i:
1) create a NSNib
2) instantiate the nib
3) enumerate over the top array (created when nib instantiated) to
find the window/panel
4) find my NSImageView in this panel (via viewWithTag to the
contentview of my panel)
5) create a critical alert panel via NSGetCriticalAlertPanel
6) find the badged icon in the critical alert (ie, scan the subviews
of the panels content view looking for a NSImageView and then getting
its image)
7) set the image of my own image view to the one i found in the alert panel
8) "run" my alert via NSApp runModalForWindow
9) appropriate cleanup when done

this works fine, but seems overly complex to me. what is the more
accepted way of accomplishing this?

thanx,
ken

Related mailsAuthorDate
mlhow do i get a badged app icon? Ken Victor Oct 17, 01:22
mlRe: how do i get a badged app icon? Jeremy Dronfield Oct 17, 15:33