美文网首页
translatesAutoresizingMaskIntoCo

translatesAutoresizingMaskIntoCo

作者: liboxiang | 来源:发表于2018-04-25 14:11 被阅读3次

autoresizingMask

  • 一个整数位掩码,用于确定接收者在其父视图界限更改时如何调整自身的大小。
  • 如果使用autoresizingMask,则当view的bounds改变的时候,view会根据子视图的autoresizing mask自动布局子视图

translatesAutoResizingMaskIntoConstraints

如果此属性为true,则此UIView的UIView.Superview将将此UIView的UIView.AutoresizingMask转换为NSLayoutConstraints并将其包含在UIView.Superview的UIView.Constraints中。这将完全限制这个UIView和自动布局将无法调整或重新定位此UIView。

在以下情况需要将translatesAutoResizingMaskIntoConstraints设置为NO
  • 编程方式创建的视图,默认值为true,对于来自Interface Builder的视图,默认值为false
  • 并且使用auto layout 布局视图,而不是frame
  • 并且视图被添加到auto layout布局的视图上.

相关文章

网友评论

      本文标题:translatesAutoresizingMaskIntoCo

      本文链接:https://www.haomeiwen.com/subject/uezelftx.html