• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can't set image in NSImageView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't set image in NSImageView


  • Subject: Re: Can't set image in NSImageView
  • From: lbland <email@hidden>
  • Date: Sat, 7 Feb 2004 10:12:03 -0500

On Feb 7, 2004, at 9:36 AM, M. Uli Kusterer wrote:

// [statusImage setImage:@"onstate.png"]; // doesn't work

NSString *myImage;
myImage = @"onstate.png";
[statusImage setImage:(NSImage *)myImage];

Seeing you try this, I think assigning an image to an object isn't really your problem. Your problem is that you need to learn Objective C first. Without that knowledge, there's not much point in trying to typecast your way around.

try something like this:

NSString *myImageName = @"onstate.png";
NSImage *myImage = [NSImage imageNamed: myImageName];
[statusImage setImage:myImage];

See the description of "imageNamed" in the NSImage docs.

-lance
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Can't set image in NSImageView (From: email@hidden)
 >Re: Can't set image in NSImageView (From: "M. Uli Kusterer" <email@hidden>)

  • Prev by Date: Re: Can't set image in NSImageView
  • Next by Date: Re: [Q] NSScanner -> \t\t how to fix??
  • Previous by thread: Re: Can't set image in NSImageView
  • Next by thread: Re: Can't set image in NSImageView
  • Index(es):
    • Date
    • Thread