Simple category for changing window size to fit content
- (void)resizeWindowForContentSize:(NSSize)size animated:(BOOL)animated { | |
NSRect windowFrame = [self contentRectForFrameRect:[self frame]]; | |
NSRect newWindowFrame = [self frameRectForContentRect: | |
NSMakeRect( NSMinX( windowFrame ), NSMaxY( windowFrame ) - size.height, size.width, size.height )]; | |
[self setFrame:newWindowFrame display:YES animate:animated]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment