Re: Icon for docklings Icon for docklings
Re: Icon for docklings Icon for docklings
- Subject: Re: Icon for docklings Icon for docklings
- From: Cyril Godefroy <email@hidden>
- Date: Mon, 14 May 2001 16:38:38 +0200
Thibaut,
Your code is not working for several reasons:
- you're trying to read an icon as an image, and icons are not supported
as image representations.
- you're trying to load the file from your resources, but as it's a
bundle, it doesn't know the same way as an application the path to your
resources
- the size of the dockling icon is 128x128 (that's minor).
When you look at the code I sent you, you see that:
- I create an NSImageView
- I use the _bundle_ provided by the initWithBundle method to find the
icon.tiff image
- Not shown here is the fact that I also send a [window
setBackgroundColor:[NSColor clearColor]]; as recommended by Brian
Webster in his article.
That guy should deserve this: explanations are there, but I won't expect
anybody with less than 2 months full time Objective-C cocoa experience
to undestand it and find that wonderful line of code by himself. Still
playing in the rookie team aren't we?
Now, if somebody can explain me how I get this stupid icon to work (it's
the second time I have the problem!!)
Le mardi 15 mai 2001, ` 01:27, smetsth a icrit :
>
I dont understand why my source code is not working... I hope that
>
someone will help me...
>
>
On Monday, May 14, 2001, at 07:24 AM, Cyril Godefroy wrote:
>
>
> Thanks a lot for your help Thibaut, I got it.......
>
>
>
> image_view = [[NSImageView alloc]
>
> initWithFrame:NSMakeRect(0,0,128,128)];
>
> [image_view setImage:[[NSImage alloc]
>
> initWithContentsOfFile:[bundle pathForResource:@"icon"
>
> ofType:@"tiff"]]];
>
> [window setContentView:image_view];
>
> [window display];
>
>
>
> Yeah!
>
>
>
> Le lundi 14 mai 2001, ` 02:45, <email@hidden> a icrit :
>
>
>
>> image_view = [[NSImageView alloc]
>
>> initWithFrame:NSMakeRect(0,0,48.0,
>
>> 48.0)];
>
>> [image_view setImage:[NSImage
>
>> imageNamed:@"AppIcon.icns"]];
>
>
-----------------------------------------------------
Lab Production devient Lost Boys Paris
en savoir plus :
http://www.lelab.com
-----------------------------------------------------
Cyril Godefroy - R&D
Lost Boys Paris
10, rue Vauvenargues
75018 Paris
Tel +33 1 53 41 70 30