programmatically drawing an NSImageView in an NSView subclass
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.