setAutoresizingMask from code in osx

autoresizingmask, cocoa, objective-c, xcode

Solution

Look at these `-setAutoresizingMask` parameters:

NSViewNotSizable

The receiver cannot be resized.

NSViewMinXMargin

The left margin between the receiver and its superview is flexible.

NSViewWidthSizable

The receiver’s width is flexible.

NSViewMaxXMargin

The right margin between the receiver and its superview is flexible.

NSViewMinYMargin

The bottom margin between the receiver and its superview is flexible.

NSViewHeightSizable

The receiver’s height is flexible.

NSViewMaxYMargin

The top margin between the receiver and its superview is flexible.

So You can do it like this:

[YourOutlet setAutoresizingMask: NSViewMinXMargin | NSViewMinYMargin];

Problem

There is a section in size inspector with name Atosizing that can set left,right,up,down layout of a control,i find that i do that with `setAutoresizingMask` but don't know how set it that my control layout to right and up (means when user resize window my control steak to right and up)

Original source

Related problems