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);

        }];

  • 相关阅读:
    BZOJ3509: [CodeChef] COUNTARI
    BZOJ3790: 神奇项链
    BZOJ3527: [Zjoi2014]力
    BZOJ2194: 快速傅立叶之二
    解题:BJOI 2006 狼抓兔子
    解题:SDOI 2017 数字表格
    解题:TJOI 2015 弦论
    解题:NOI 2016 优秀的拆分
    解题:AHOI2017/HNOI2017 礼物
    解题:洛谷2093 JZPFAR
  • 原文地址:https://www.cnblogs.com/huoran1120/p/5133757.html
Copyright © 2011-2022 走看看