开发者

Resize Cocoa windows proportionally

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜