Re: Dynamically Resize NSView Subclass to NSScrollView
Re: Dynamically Resize NSView Subclass to NSScrollView
- Subject: Re: Dynamically Resize NSView Subclass to NSScrollView
- From: "Ujwal S. Sathyam" <email@hidden>
- Date: Sat, 24 Jan 2004 18:01:50 -0800
That's pretty much the function of the scrollview. You will have to set:
[scrollView setDocumentView: canvasView];
[canvasView setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
either in your nib or in code.
That should do it.
Ujwal
I am developing a drawing application that allows users to draw arbitrary
shapes onto a canvas, very similar to Apple's Sketch example application. I
would like the size of the canvas to follow the size of its containing
NSScrollView as long as it is large enough to display the contents of the
canvas. If the NSScrollView is shrunk below the amount of space needed to
display the graphics then I would like the canvas to stop resizing allowing
the scrollbars to appear. To clarify here are a few example scenarios of how
I would like it to work:
- The user requires more canvas surface for their graphics and so they resize
the window to fit the additional content. As the window is enlarged the
NSScrollView is enlarge and the NSView follows in suit by enlarging its
drawing surface.
- The user has drawn all of the graphics for a particular canvas and doesn't
want the window taking up all of their desktop space but wants to work with
particular sections of the canvas so they shrink the window smaller than the
space required by the canvas to display all the graphics. Once the size
becomes too small to display all of the graphics the NSView stops resizing
and the NSScrollView then displays its scrollbars allowing the user to scroll
over the canvas.
_______________________________________________
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.