Reputation: 23374
My ContentView could be slightly larger than my NSWindow. How can I automagically resize when a new ContentView is set?
Upvotes: 0
Views: 371
Reputation: 12566
I don't know a way to do it automagically. That may be possible if you are using Cocoa auto layout.
If you are using regular springs and struts layout, just resize the window when you change the content view. You can use the SetFrame
method to resize the window.
In Objective C, the relevant methods on NSWindow are:
setFrame:display:
setFrame:display:animate:
And their C# equivalents for monomac:
public void SetFrame (RectangleF frameRect, bool display)
public void SetFrame (RectangleF frameRect, bool display, bool animate)
Upvotes: 1