开发者

Resize Cocoa windows proportionally

开发者 https://www.devze.com 2023-02-16 08:31 出处:网络
I was wondering how I could constrain an application window to be resized o开发者_JAVA技巧nly proportionally? I want it to keep the ratio so as not to distort photos/videos.You would probably do this

I was wondering how I could constrain an application window to be resized o开发者_JAVA技巧nly 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:].

0

精彩评论

暂无评论...
验证码 换一张
取 消