Re: NSScrollView's document view resizing?
Re: NSScrollView's document view resizing?
- Subject: Re: NSScrollView's document view resizing?
- From: Todd Heberlein <email@hidden>
- Date: Wed, 12 Dec 2012 13:30:59 -0800
On Dec 12, 2012, at 12:11 PM, Kyle Sluder <email@hidden> wrote:
> There is a workaround, though: instead of dragging out a Scroll View
> from the Object Library, drag out a Custom View and choose Editor >
> Embed > In Scroll View.
Yes, I get two different results depending on how I created a custom view inside an NSScrollView.
To test, I added the following method to my NSView subclass (SillyView) with a button in the window to trigger it.
- (IBAction)showStats:(id)sender
{
NSRect myFrame = [self frame];
NSLog(@"my frame size: %f, %f", myFrame.size.width, myFrame.size.height);
NSLog(@"autoresizingMask: %ld", [self autoresizingMask]);
}
-----------------------------------------------------
Approach 1: Drag in NSScrollView
I dragged an NSScrollView into the window and set the documentView to SillyView.
When I resize the window, SillyView is resized (what I don't want)
The autoresizingMask is set to 18:
NSViewWidthSizable | NSViewHeightSizable
-----------------------------------------------------
Approach 2: Embed in NSScrollView
I dragged a custom view into the window and set it to SillyView.
Then I selected the view and selected Editor > Embed In > Scroll View
When I resize the window, SillyView is *NOT* resized (what I do want)
The autoresizingMask is set to 12:
NSViewMaxXMargin | NSViewMinYMargin
So two different ways to create a custom view inside an NSScrollView, and the two approaches give you two different behaviors.
Is this a bug?
Todd
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden