Re: Adding an NSImageView to an NSView
Re: Adding an NSImageView to an NSView
- Subject: Re: Adding an NSImageView to an NSView
- From: "Geert B. Clemmensen" <email@hidden>
- Date: Thu, 7 Apr 2005 09:07:51 +0200
On 7. apr 2005, at 8.59, Duncan Campbell wrote:
Hey folks.
I'm trying to add an NSImageView subclass to an NSView. Useless snippet:
myImageView = [[NSImageView alloc] init];
[myImageView setImage:[NSImage imageNamed:@"myimage.tiff"]];
[myView addSubview: myImageView];
This seems to work fine (i am setting up the NSRect position of the NSImageView correctly), except my image never shows. I have tried writing some custom coloring code in the NSImageView and it does show correctly on the NSView (i.e. i see a colored square, tracking rects work etc.) - it's just the image that isn't showing.
I have also tried replacing the NSImageView with an NSButton and it shows the image correctly (so it's not something silly like a typo in the image filename).
Anyone have a clue what's (not) going on?
1) Check that the actual file is included in the project and 2) try and omit the '.tiff' extension. Third, try and do something like
NSLog(@"myimage=%@", [NSImage imageNamed:...]);
My suspicion is that NSImage can't find the file
Regards,
Geert B. Clemmensen
www.frontbase.com
_______________________________________________
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