setAutoresizingMask from code in osx

限于喜欢 提交于 2019-12-03 20:21:48

问题


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)


回答1:


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];


来源:https://stackoverflow.com/questions/10370140/setautoresizingmask-from-code-in-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!