• 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
programmatically drawing an NSImageView in an NSView subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

programmatically drawing an NSImageView in an NSView subclass


  • Subject: programmatically drawing an NSImageView in an NSView subclass
  • From: Benjámin Salánki <email@hidden>
  • Date: Sat, 10 Jan 2004 20:31:11 +0100

hi,

i want to draw some NSImageViews in my NSView subclass.

i use the following code in my drawRect: method:

- (void)drawRect:(NSRect)rect
{
//drawing code here
int numberOfFiles = [_files count];
int i;
for(i=0;i<numberOfFiles;i++)
{
NSImageView* theView = [[NSImageView alloc]
initWithFrame:NSMakeRect(15+(i%3)*85, 15+(i/3)*72, 70.00, 56.00)];
[theView setImageFrameStyle:NSImageFramePhoto];
[theView setImageAlignment:NSImageAlignCenter];
[theView setImageScaling:NSScaleProportionally];
[theView setImage:[[NSImage alloc] initWithContentsOfFile:[_files
objectAtIndex:i]]];
[theView setTag:i];
[theView setTarget:self];
[theView setAction:@selector(what:)];
}
}

the calculations get done and everything, CPU cycles get eaten, but the
view does not display the imageViews. I tried to replace the code and
draw simple rects with NSBezierPath, and that works like a charm.

any ideas?

thx,
Ben

stupidFish23
http://www.stupidfish23.com
_______________________________________________
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.

  • Follow-Ups:
    • Re: programmatically drawing an NSImageView in an NSView subclass
      • From: p3consulting <email@hidden>
    • Re: programmatically drawing an NSImageView in an NSView subclass
      • From: John Randolph <email@hidden>
    • Re: programmatically drawing an NSImageView in an NSView subclass
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Any word on GarageBand plug-ins
  • Next by Date: Executing Javascript in webview
  • Previous by thread: RE: Any word on GarageBand plug-ins
  • Next by thread: Re: programmatically drawing an NSImageView in an NSView subclass
  • Index(es):
    • Date
    • Thread