• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how do i get a badged app icon?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do i get a badged app icon?


  • Subject: Re: how do i get a badged app icon?
  • From: Jeremy Dronfield <email@hidden>
  • Date: Sun, 17 Oct 2004 14:33:03 +0100


On 17 Oct 2004, at 12:22 am, Ken Victor wrote:

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.

I'm not entirely clear what you want, but it sounds like you just want the badged icon image, rather than actually badging your app's icon (for display in the dock, say). You could try something like this:

NSImage *appImage = [NSImage imageNamed:@"MyAppIcon"];

NSImage *badge = [NSImage imageNamed:@"MyBadgeImage"];
[badge setScalesWhenResized:YES];
[badge setSize:NSMakeSize(64, 64)];

[appImage lockFocus];
[badge compositeToPoint:NSMakePoint(aPointX, aPointY) operation:NSCompositeSourceOver];
[appImage unlockFocus];

[myImageView setImage:appImage];

Of course, you'll want to play with the sizing and placement of the badge to get it right. And you'll need to "borrow" a badge image from somewhere. If you want to badge the actual icon as it appears in the dock, app switcher etc, then use [NSApp setApplicationIconImage:appImage].

Hope this helps.

Regards,
Jeremy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >how do i get a badged app icon? (From: Ken Victor <email@hidden>)

  • Prev by Date: Re: Emulating mouse clicks
  • Next by Date: What to do with initWithFormat + an array
  • Previous by thread: how do i get a badged app icon?
  • Next by thread: DOs and firewalls
  • Index(es):
    • Date
    • Thread