Contents

aspectRatio

The window’s aspect ratio, which constrains the size of its frame rectangle to integral multiples of this ratio when the user resizes it.

Declaration

var aspectRatio: NSSize { get set }

Discussion

The size of the window’s frame rectangle is constrained to integral multiples of this ratio when the user resizes it. You can set an NSWindow object’s size to any ratio programmatically.

An NSWindow object’s aspect ratio and its resize increments are mutually exclusive attributes. In fact, setting one attribute cancels the setting of the other. For example, to cancel an established aspect ratio setting for an NSWindow object, you can set the resizeIncrements property with the width and height set to 1.0:

myWindow.resizeIncrements = NSMakeSize(1.0,1.0);

The contentAspectRatio property takes precedence over this property.

See Also

Sizing Windows