zoukankan      html  css  js  c++  java
  • Autolayout

    1.这个位置选适应什么样子的屏幕

    2.两种方法选择约束

    第一种:

    第二种:

    3.代码添加约束————导入第三方库Masnory

     [super viewDidLoad];

        UIView * redview = [[UIView alloc]init];

        redview.backgroundColor = [UIColor redColor];

        [self.view addSubview:redview];

        UIView * blueview = [[UIView alloc]init];

        blueview.backgroundColor = [UIColor blueColor];

        [self.view addSubview:blueview];

      

        [redview mas_makeConstraints:^(MASConstraintMaker *make) {

            make.leading.equalTo(self.view.mas_leading).offset(10);

            make.top.equalTo(self.view.mas_top).offset(10);

            make.height.equalTo(@100);

        }];

        [blueview mas_makeConstraints:^(MASConstraintMaker *make) {

            make.trailing.equalTo(self.view.mas_trailing).offset(-10);

            make.top.equalTo(self.view.mas_top).offset(10);

            make.height.equalTo(redview.mas_height).offset(0);

            make.width.equalTo(redview.mas_width).offset(0);

            make.leading.equalTo(redview.mas_trailing).offset(10);

        }];

  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    关于if和else和switch case的用法和程序编码操作过程
    关于java的特点
    关于JAVA的数据类型
    关于java的学习
    力扣482. 密钥字符串 S python--每天一题
  • 原文地址:https://www.cnblogs.com/huoran1120/p/5133757.html
Copyright © 2011-2022 走看看