了解自动调整属性和掩码

时间:2013-07-25 12:23:57

标签: ios objective-c interface-builder

就图像而言,值UIViewAutoresizingNone对应于哪个图像对应于何时在视图上设置?

enter image description here

3 个答案:

答案 0 :(得分:1)

您说得对,您所显示的图片相当于UIViewAutoresizingNone

自动调整,您可以从 Interface Builder 中看到,

enter image description here

以编程方式 这些struts表现为上面图像的“颠倒”,

enter image description here

以下是AutoSizingMask的一些示例 - 以编程方式与XIB。

  • UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)相当于

enter image description here

  • UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin |UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin)相当于

enter image description here

  • UIViewAutoresizingNone相当于

enter image description here

  • UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin)相当于

enter image description here

  • UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin)相当于

enter image description here

  • UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)相当于

enter image description here

  • UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)相当于

enter image description here

  • UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth)相当于

enter image description here

  • UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin

enter image description here

答案 1 :(得分:0)

UIViewAutoresizingNone执行此操作:
enter image description here

对于将来的参考,请使用侧面示例,其中显示了自动调整大小的行为:

enter image description here

答案 2 :(得分:0)

是的,您问题中的图片表示UIViewAutoresizingNone。设置外侧的栏表示“非弹性”,但内侧的箭头表示flexible

请注意,如果您尝试设置UIViewAutoresizingNone,然后调整超级视图的大小,则不会因为某些内容需要更改而受到尊重。