zoukankan      html  css  js  c++  java
  • 在代码里更新autolayout布局

     1             //遍历view约束(高,宽)
     2             NSArray* constrains = self.View.constraints;
     3             for (NSLayoutConstraint* constraint in constrains) {
     4                 if (constraint.firstAttribute == NSLayoutAttributeHeight) {
     5                     //宽高的值
     6                     constraint.constant = 45.0;
     7                 }
     8             }
     9             
    10            //遍历view约束,找到属于子view的约束
    11             NSArray* constrains2 = self.view.constraints;
    12             for (NSLayoutConstraint* constraint in constrains2) {
    13                 if (constraint.secondItem == self.table) {
    14                     //底部距离
    15                     if (constraint.firstAttribute == NSLayoutAttributeBottom) {
    16                         constraint.constant = 0.0;
    17                         
    18                     }
    19                 }
    20             }            

    内容来自网络,并部分修改,非个人原创。

  • 相关阅读:
    BZOJ 2002 [Hnoi2010]Bounce 弹飞绵羊 ——Link-Cut Tree
    BZOJ 2049 [Sdoi2008]Cave 洞穴勘测 ——Link-Cut Tree
    hdu
    hdu
    hdu
    hdu
    hdu
    hdu
    hdu
    hdu
  • 原文地址:https://www.cnblogs.com/wangqw/p/4444784.html
Copyright © 2011-2022 走看看