I was wondering how I could constrain an application window to be resized only proportionally? I want it to keep the ratio so as not to distort photos/videos.
You would probably do this in your application delegate; in a standard project template, that object has a reference to your app's main window.
- (void)awakeFromNib {
// Keep the aspect ratio constant at its current value
[window setAspectRatio:window.frame.size];
}
You don't resize applications, you resize windows. You can use -[NSWindow setContentAspectRatio:]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With