I wrote a function to set a background image. The code compiles and works fine if it's in the awakeFromNIB function but not when the code is moved to a function.
The error is:
error: 'backgroundImage' undeclared (first use in this function)
Here is the code.
void setBackgroundImage()
{
NSImage *bgimage = [NSImage imageNamed"image.jpg"];
[backgroundImage setImage:bgimage];
}
Any help would be appreciated.
The error is:
error: 'backgroundImage' undeclared (first use in this function)
Here is the code.
void setBackgroundImage()
{
NSImage *bgimage = [NSImage imageNamed"image.jpg"];
[backgroundImage setImage:bgimage];
}
Any help would be appreciated.