RE: Classes for a dummy <NSImage access>.
RE: Classes for a dummy <NSImage access>.
- Subject: RE: Classes for a dummy <NSImage access>.
- From: "Smith, Bradley" <email@hidden>
- Date: Wed, 10 Oct 2001 10:55:48 +0100
I'm not well versed in Obj-C yet but I think this is close to accurate (you
may want to see what others have to say first though). Byt here goes
anyay...
Well, your main program needs an instance of the class BackGround. You may
already have done this but in case not you can do it like so: -
// somewhere in your code / function or whatever
BackGround *theBackGround = [[BackGround alloc] init];
// Then you can get hold of the image like this: -
NSImage *localCopyOfImage = [[theBackGound image] retain];
// When you've finished wih the image...
[localCopyOfImage release];
Brad
>
>
BackGround.h :
>
>
#import <Cocoa/Cocoa.h>
>
>
@interface BackGround : NSObject {
>
NSImage *backgroundImage;
>
}
>
>
/* Initialization and De-Allocation */
>
- (id)init;
>
- (void)dealloc;
>
>
// return backgroundImage
>
- (NSImage*)image;
>
>
// modify backgroundImage
>
- (void)setImage:(NSImage *)image;
>
>
@end
>
>
My question is simple and stupid : How do I access my
>
backgroundImage from
>
the main part of my program ?
>
>
I have used @class BackGround; in my header and #import
>
"BackGround.h" in my
>
source but there I don't know how to reach my image. Please, help :(
>
>
>
-----------------------------------
>
jean-michel daix / email@hidden