/ Published in: Objective C
El texto en blanco viene definido por el parámetro theNumber.
La posición del texto viene definido por el parámetro theRect
La posición del texto viene definido por el parámetro theRect
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
-(void) updateApplicationIcon:(int) theNumber:(NSRect) theRect{ // get the current app icon // create a new image and draw the app icon onto it // lock focus on the new image and draw the app icon onto it. // you'll want the image flipped so text shows up correctly [image setFlipped:TRUE]; [image lockFocus]; NSSize appSize = [appImage size]; [appImage compositeToPoint:NSMakePoint(0, appSize.height) operation:NSCompositeSourceOver]; // draw red circle [redCircle fill]; // draw whatever else you want onto the image [text drawInRect:theRect]; // unlock focus and set the new image as the dock icon [image unlockFocus]; [NSApp setApplicationIconImage:image]; }