• 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
image wont display in custom nsview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

image wont display in custom nsview


  • Subject: image wont display in custom nsview
  • From: Jeff Childers <email@hidden>
  • Date: Thu, 6 Jan 2005 18:33:18 -0600

I have no idea why this wont work. It runs without errors
will you tell me whats wrong?

@interface
SampleView : NSView
{
NSPoint drawPoint;
NSImage *bgImage;
NSImage *spriteImage;
}

- (void)drawRect: (NSRect)rect;
@end

________________________________________________________
@implementation
SampleView

- (BOOL)acceptsFirstMouse: (NSEvent *)event {

YES);
}

- (void)awakeFromNib {
drawPoint = NSMakePoint(0);
bgImage = [NSImage imageNamed:@"body.png"];
spriteImage = [NSImage imageNamed:@"body.png"];
}

- (void)drawRect: (NSRect)rect {


[bgImage compositeToPoint:NSMakePoint(0) operation:NSCompositeSourceOver];
[spriteImage compositeToPoint:drawPoint operation:NSCompositeSourceOver];

[self setNeedsDisplay:YES];

}
- (void)mouseDown: (NSEvent *)event {

drawPoint = [self convertPoint:[event locationInWindow] fromView:nil];
NSLog(@"Mouse at %@", NSStringFromPoint(drawPoint));
[self setNeedsDisplay:YES];
}
- (BOOL)acceptsFirstResponder
{
return YES;
}

@end
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Most efficient way to get the pixel dimensions of a JPG
  • Next by Date: Re: Customising the behaviour of an NSTextFieldCell in an NSTableView
  • Previous by thread: RE: Scrolling a view containing two subviews (NSTextView weirdness)
  • Next by thread: Problems with NSTimer and NSRunLoop/CFRunLoop
  • Index(es):
    • Date
    • Thread