setAutoresizingMask from code in osx

前端 未结 1 1017
别那么骄傲
别那么骄傲 2021-01-01 04:12

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

相关标签:
1条回答
  • 2021-01-01 04:37

    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];
    
    0 讨论(0)
提交回复
热议问题