• 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: Drawing an image in a CustomView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing an image in a CustomView


  • Subject: Re: Drawing an image in a CustomView
  • From: Enigmarelle Development <email@hidden>
  • Date: Mon, 14 Jan 2002 23:01:20 -0500

On Monday, January 14, 2002, at 10:46 PM, Mike Brinkman wrote:

I tried to get something out of "Cocoa Programming", but obviously missed
the point.

I created a new project called "SimpleImage". The goal is to draw an image
in a window.

I then created an Obj-C NSView subclass called "simpleImageView.m" and it'
s
header "simpleImageView.h".



(code snipped)
- (void)drawRect:(NSRect)rect {
// Drawing code here.
image = [[NSImage alloc] initWithContentsOfFile:@"macosxlogo.gif"];
[simpleImageView setImage:image];
}

Replace 'simpleImageView' with 'self' above & all looks like it should work. (haven't tried it though.) If all you want to do is display an image though, use a borderless NSImageView and set its image in IB. Part of learning Cocoa is learning to be lazy ;)


Here are my ERROR MESSAGES:
2002-01-14 22:32:06.780 SimpleImage[394] *** +[simpleImageView setImage:]
:
selector not recognized
2002-01-14 22:32:06.851 SimpleImage[394] An uncaught exception was raised
2002-01-14 22:32:06.872 SimpleImage[394] *** +[simpleImageView setImage:]
:
selector not recognized
2002-01-14 22:32:06.889 SimpleImage[394] *** Uncaught exception:
<NSInvalidArgumentException> *** +[simpleImageView setImage:]: selector not
recognized

SimpleImage.app has exited with status 255.


I'm sure this is probably the type of thing that would take 2 lines of code,
instead of all the stuff I tried to write right here. Maybe somebody could
help me out?




-john c. warner
enigmarelle development
http://www.enigmarelle.com/


  • Follow-Ups:
    • Re: Drawing an image in a CustomView
      • From: Scott Anguish <email@hidden>
References: 
 >Drawing an image in a CustomView (From: Mike Brinkman <email@hidden>)

  • Prev by Date: Faceless Background Application
  • Next by Date: Re: NSWorkspaceDidTerminateApplicationNotification bug?
  • Previous by thread: Drawing an image in a CustomView
  • Next by thread: Re: Drawing an image in a CustomView
  • Index(es):
    • Date
    • Thread