xcode setAutoresizingMask 从 osx 中的代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10370140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
setAutoresizingMask from code in osx
提问by Justin Boo
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)
尺寸检查器中有一个名为 Atosizing 的部分,可以设置控件的左、右、上、下布局,我发现我这样做了,setAutoresizingMask
但不知道如何将它设置为我的控件布局向右和向上(意味着当用户调整窗口大小时,我的控制牛排向右和向上)
回答by Justin Boo
Look at these -setAutoresizingMask
parameters:
看看这些-setAutoresizingMask
参数:
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.
NSViewNotSizable
接收器无法调整大小。
NSViewMinXMargin
接收器与其父视图之间的左边距是灵活的。
NSViewWidthSizable
接收器的宽度是灵活的。
NSViewMaxXMargin
接收器与其父视图之间的右边距是灵活的。
NSViewMinYMargin
接收器与其父视图之间的下边距是灵活的。
NSViewHeightSizable
接收器的高度是灵活的。
NSViewMaxYMargin
接收器与其父视图之间的上边距是灵活的。
So You can do it like this:
所以你可以这样做:
[YourOutlet setAutoresizingMask: NSViewMinXMargin | NSViewMinYMargin];