Strange resizing issue with NSView
Strange resizing issue with NSView
- Subject: Strange resizing issue with NSView
- From: John Stiles <email@hidden>
- Date: Mon, 30 Jan 2006 16:43:52 -0800
I have written some code which adds a WebView inside an NSBox.
It's pretty simple. In the following code, HTMLSheetWebContainer is
an NSBox in my nib, and HTMLSheetWebView is a WebView*.
The code goes like this:
NSRect bounds = [HTMLSheetWebContainer bounds];
// If I don't inset the bounds by 2 pixels, the box lines cover up
the edges of the web view.
bounds.size.height -= 2.0;
bounds.size.width -= 2.0;
HTMLSheetWebView = [[WebView alloc] initWithFrame:bounds
frameName:NULL groupName:NULL];
[HTMLSheetWebContainer addSubview:HTMLSheetWebView];
[HTMLSheetWebView setAutoresizingMask:(NSViewWidthSizable |
NSViewHeightSizable)];
Despite setting the auto-resize mask, I found that the web view would
not resize no matter what I did. I added a call to
[HTMLSheetWebContainer setAutoresizesSubviews:YES] but that was
ineffective.
After a bit of head-scratching and debugging, I realized that if I
added any resizing object inside the NSBox in my nib, suddenly the
web-view started resizing too. I can't explain why that worked, but
it did. I ended up adding a tiny Custom View to the bottom corner of
my NSBox, and all seemed to be well.
Is this a bug in the NSView system or am I missing something?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden