Is it possible to draw multiple NSImages in a single NSView?
So far drawing in an NSView subclass is done like so:
- (void)drawRect:(NSRect)dirtyRect
{
[image drawInRect:NSMakeRect(0.0f, 0.0f, 100.0f, 100.0f) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f];
}
//to change the current image
- (void)newImage:(NSImage *)image_
{
[image release];
image = [image_ retain];
[self setNeedsDisplay:YES];
}
But this is for drawing just one image. Can anyone please help out?
Thanks.
You have to keep references to the images you need to draw.
Then, add the images with a suitable API, for example:
In
drawRect:you can iterate through theimagesand draw all/some of them.