Re: Dock Icon Help
Re: Dock Icon Help
- Subject: Re: Dock Icon Help
- From: j o a r <email@hidden>
- Date: Fri, 9 May 2003 10:14:57 +0200
On Friday, May 9, 2003, at 09:42 Europe/Stockholm, Andreas Schempp
wrote:
Try to retain your image, before you use it.
Or do something like this:
NSImage* coolImage = [[NSImage alloc] init];
[coolImage initWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:@"2d Marine Division" ofType:@"icns"]]
This is a pretty crappy suggestion... Why should he need to increase
the retain count of the image before handing it over? It's also invalid
use of ObjC - you cannot init an object multiple times! Better version,
with some logs added for troubleshooting purposes:
NSString *imgPath = [[NSBundle mainBundle] pathForResource: @"ImgName"
ofType: @"tiff"]; // If it is in tiff...
if (imgPath != nil)
{
NSImage *img = [[[NSImage alloc] initWithContentsOfFile: imgPath]
autorelease];
if (img != nil)
{
[NSApp setApplicationIconImage: img];
}
else
{
NSLog(@"Could not create image");
}
}
else
{
NSLog(@"Could not locate image");
}
Another question: is you image a real .icns file? not a tiff or
something
thelike?...
Why would he use an icns file? Tiff files wold work just fine for this
purpose.
j o a r
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.