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
精彩评论