Re: How to draw background image in my app window
Re: How to draw background image in my app window
- Subject: Re: How to draw background image in my app window
- From: cocoa learner <email@hidden>
- Date: Sat, 30 May 2009 20:27:21 +0600
Thanx Nick for your reply.But in my window I am not getting the image I want
to display. Here is my code -
- (id) init
{
[super init];
NSLog(@"AppController::init : Setting the windows content");
NSBundle *myBundle = [NSBundle mainBundle];
if (myBundle == NULL)
{
NSLog(@"AppController::init : myBundle is NULL");
}
else
{
NSLog(@"AppController::init : myBundle is not NULL");
}
NSString *path = [myBundle pathForResource:@"winImg" ofType:@"png"];
NSLog(@"AppController::init : Image file path : %@", path);
NSImageView *winContent = [[NSImage alloc] initWithContentsOfFile:path];
[ appWindow setContentView: winContent];
NSLog(@"AppController::init : The windows content has been set");
return self;
}
I can see all the logs. But not the image in back ground of my app window.
Am I doing any thing wrong in this code?
Regards
Cocoa.learner.
On Tue, May 26, 2009 at 11:12 PM, Nick Zitzmann <email@hidden> wrote:
>
> On May 26, 2009, at 11:04 AM, cocoa learner wrote:
>
> How to draw background image in my app window?
>>
>
> You could change the window's content view using -setContentView: to a view
> that will draw a background image, such as NSImageView... Of course, if you
> have any other controls in the content view that is being replaced, then
> they'll be lost.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>
>
>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden