On Jul 1, 2008, at 6:41 AM, Papa-Raboon wrote:

I have been trying to get a static image to display in a corner of my
window and it has to literally just sit there and do nothing however I
have searched and searched Apple's dodumentation but no success yet.

I have dropped an Image View onto the window in IB and set the
following in my .h file in Xcode:

       IBOutlet NSImageView *theImage;

Then in my .m file I have this so far:

        NSString *imageName;
        NSImage *tempImage;
        
imageName = [[NSBundle mainBundle] pathForResource:@"logo" ofType:@"PNG"];
        tempImage = [[NSImage alloc] initWithContentsOfFile:imageName];

My image is set in my project in the resources folder and is called
logo.png and I hooked up the object to the NSImageView using IB.

Can't seem to get it to display. I believe I have a line of code
missing that will tie my MSImage to my NSImageView but not sure how.

Any Ideas please?

I'm pretty new to cocoa and don't understand all the lingo yet so be
gentle please.

This is just a static image from your application's bundle, so you should be able to do everything in IB without writing any code. After dragging a NSImageView into your window, open the Inspector window if it's not already open. Then set attributes Image=logo (Cocoa will figure out the file's extension), Border=none, Scale: to fit. Select Size from the inspector's popup menu and set the size to the image's size. Depending on where the image will be in your window, you may need to set the autosizing struts and springs right below the size info. You can find out if it stays in the correct place when your window resizes by selecting Test Interface from the File menu (command-R).

steve



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to