Trying to display a static image on my window. Any tips would be great

2008-07-01 Thread Papa-Raboon
Hi All,

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.

Cheers
Paul
___

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]


Re: Trying to display a static image on my window. Any tips would be great

2008-07-01 Thread Hamish Allan
On Tue, Jul 1, 2008 at 2:41 PM, Papa-Raboon <[EMAIL PROTECTED]> wrote:

> 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.

Have you tried [theImage setImage:tempImage]? That is, setting the
image of the image view to the image you loaded.

Hamish
___

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]


Re: Trying to display a static image on my window. Any tips would be great

2008-07-01 Thread Chris Paveglio
(I'm new also so someone please correct me if this is wrong...)

If your image does nothing at all (or never changes), could you just set in 
directly in IB? I've made some Applescript apps with images in an image view, I 
just drag the image (in IB's Image panel) directly into my window, or into an 
NSImageView box.
Maybe you don't even need a line of code for it.

Chris

>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.



  

___

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]


Re: Trying to display a static image on my window. Any tips would be great

2008-07-01 Thread Steve Christensen

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]


Re: Trying to display a static image on my window. Any tips would be great

2008-07-01 Thread Steve Christensen
If you add an IBAction method to your window controller's class, it  
can respond to a click on the image by calling


[[NSWorkspace sharedWorkspace] openURL:@"http://www.apple.com";];


On Jul 1, 2008, at 9:09 AM, Papa-Raboon wrote:


Thanks loads for that Steve. It seems to be doing as I wanted now.
Someone kindly pointed out that if I created my image with an Alpha
chanel that it could also have transparencies too which worked
beautifully. I just need to figure out how to hyperlink it so it can
open a URL in a browser now.

Cheers
Paul

2008/7/1 Steve Christensen <[EMAIL PROTECTED]>:

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]