开发者

Setting the minimum and maximum size of a window

开发者 https://www.devze.com 2023-03-01 08:42 出处:网络
How does one se开发者_如何转开发t the maximum and minimum size of a window in OS X, using the Objective-C libraries?[theWindow setMaxSize:windowMaxSize];

How does one se开发者_如何转开发t the maximum and minimum size of a window in OS X, using the Objective-C libraries?


[theWindow setMaxSize:windowMaxSize];
[theWindow setMinSize:windowMinSize];

NSWindow Class Reference


In Swift 2 this would be:

myWindow.contentMinSize = NSSize(width: 600, height: 500)
myWindow.contentMaxSize = NSSize(width: 1024, height: 780)

Also according to the Apple docs, contentMinSize takes precedent over setMaxSize.

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/index.html#//apple_ref/occ/instp/NSWindow/contentMaxSize

0

精彩评论

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