zoukankan      html  css  js  c++  java
  • XCode5 使用AutoLayout情况下改变控件的 方法

    [self.viewButtonsetTranslatesAutoresizingMaskIntoConstraints:NO];

        //[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.viewButton attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]];

        //改变 高度

        [self.viewaddConstraint:[NSLayoutConstraint

                                  constraintWithItem:self.viewButton

                                  attribute:NSLayoutAttributeHeight

                                  relatedBy:NSLayoutRelationEqual

                                  toItem:self.view

                                  attribute:NSLayoutAttributeHeight

                                  multiplier:0.3

                                  constant:0]];

        [self.viewButtonaddObserver:selfforKeyPath:@"bounds"options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitialcontext:nil];//注册kvo监听bounds的变化

        

    }

    //kvo回调

    - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context

    {

        if (object == self.viewButton && [keyPath isEqualToString:@"bounds"])

        {

    //        [self.viewButton setTitle:NSStringFromCGSize(self.viewButton.bounds.size) forState:UIControlStateNormal];

            

            NSLog(@"");

        }

    }

  • 相关阅读:
    day 24
    day23
    day 22
    java中空格的操作
    java 解析Word文档以及Excel表格数据带有图片(2003/2007)
    java中创建文件夹
    http请求问题
    js弹框显示全部内容
    java实现HTTP请求的三种方式
    solr与java整合使用
  • 原文地址:https://www.cnblogs.com/chenhaosuibi/p/3520304.html
Copyright © 2011-2022 走看看