resizing a NSView
resizing a NSView
- Subject: resizing a NSView
- From: email@hidden (Henri Hansen)
- Date: Tue, 15 Jan 2002 19:17:41 +0100
Hi
I'd like to write a little application to manipulate images. Therfore,
when one opens an image, I want to display the image in a window, which
has the same size as the image.
In order to learn how to resize a window and a subclass of a view I
greated a small ap with some TextFields and Buttons to read and set the
size of the window and the view (a subclass of NSView). The resizing of
the window by seting its frame
[myWindow setFrame:r display:YES];
where r is a NSRect. But a similar procedure with the view:
[myDocView setFrame:r];
[myDocView setNeedsDisplay:YES];
or something with:
[myDocView drawRect:r];
has no effect :-(
My view has the following method:
-(void) drawRect:(NSRect)rect
{
NSRect bounds = [self bounds];
[[NSColor greenColor] set];
[NSBezierPath fillRect:bounds];
}
I realy need some guidence or help, because I don't see why this is
working with the window and not with the view --- in both cases I'm only
changing their framesize???
thanks a lot
greetings henri