I have a custom view that contains a WebView. My custom view does its own layout in resizeWithOldSuperviewSize:
then invokes resizeSubviewsWithOldSize:
to resize its subviews.
My custom view contains a WebView, an NSTextField, and another custom view. The NSTextField and the custom view react very nicely to changes in size of the window, but my WebView just sits there at its original size.
EDIT: Note that the position of the WebView changes as expected but the size does not.
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize
{
NSRect superBounds = self.superview.bounds;
// ... set frames on other subviews; works fine ...
// Move the WebView
NSRect oldFrame = webView.frame;
[self setNeedsDisplayInRect:oldFrame];
NSRect newFrame = NSMakeRect(superBounds.origin.x, 55.0, superBounds.size.width, superBounds.size.height - 55.0);
[webView setFrame:newFrame];
// This doesn't work:
// [[[[webView mainFrame] frameView] documentView] setNeedsDisplay:YES];
// Neither does this:
// [webView setNeedsDisplayInRect:newFrame];
}
Any suggestions?