Masonry在此实现时候,并没有比NSLayoutConstraint简单,相反我觉得还不如NSLayoutConstraint。

    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view.mas_top);
make.right.equalTo(self.view.mas_right).with.offset(-);
make.width.equalTo(@);
make.height.equalTo(@);
}]; [btnSetting mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.view.mas_bottom).with.offset(-);
make.right.equalTo(self.view.mas_right).with.offset(-);
make.width.equalTo(@);
make.height.equalTo(btnSetting.mas_width);
}]; [self.scrolleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(image.mas_bottom);
make.left.equalTo(self.view.mas_left);
make.width.equalTo(@(WIDTH-));
make.height.equalTo(@(HEIGHT - - ));
}];

下面是使用NSLayoutConstraint的代码实现

                                [NSLayoutConstraint constraintWithItem:self.topView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:],
[NSLayoutConstraint constraintWithItem:self.topView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:-],
[NSLayoutConstraint constraintWithItem:self.topView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:],
[NSLayoutConstraint constraintWithItem:self.topView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:], [NSLayoutConstraint constraintWithItem:btnSetting attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-],
[NSLayoutConstraint constraintWithItem:btnSetting attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:-],
[NSLayoutConstraint constraintWithItem:btnSetting attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:],
[NSLayoutConstraint constraintWithItem:btnSetting attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:btnSetting attribute:NSLayoutAttributeWidth multiplier:1.0 constant:], [NSLayoutConstraint constraintWithItem:self.scrolleView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:image attribute:NSLayoutAttributeBottom multiplier:1.0 constant:],
[NSLayoutConstraint constraintWithItem:self.scrolleView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:],
[NSLayoutConstraint constraintWithItem:self.scrolleView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:WIDTH],
[NSLayoutConstraint constraintWithItem:self.scrolleView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:HEIGHT - - ]

至于使用哪种布局库,自行斟酌。。。。

Masonry应用【美图秀秀首页界面自动布局】的更多相关文章

  1. iOS开发系列--打造自己的“美图秀秀”

    --绘图与滤镜全面解析 概述 在iOS中可以很容易的开发出绚丽的界面效果,一方面得益于成功系统的设计,另一方面得益于它强大的开发框架.今天我们将围绕iOS中两大图形.图像绘图框架进行介绍:Quartz ...

  2. iOS开发系列--打造自己的“美图秀秀”

    概述 在iOS中可以很容易的开发出绚丽的界面效果,一方面得益于成功系统的设计,另一方面得益于它强大的开发框架.今天我们将围绕iOS中两大图形.图像绘图框架进行介绍:Quartz 2D绘制2D图形和Co ...

  3. 强大的修图app--美图秀秀

    美图秀秀的强大之处   市面上有很多图形处理软件,最专业的是ps,但是ps做起来需要的专业技术很高,而美图秀秀可以说用起来并不需要很专业,操作起来非常方便,而且界面可爱.所以说美图秀秀是一款很好用的免 ...

  4. 强大的Core Image(教你做自己的美图秀秀))

    iOS5新特性:强大的Core Image(教你做自己的美图秀秀))       iOS5给我们带来了很多很好很强大的功能和API.Core Image就是其中之一,它使我们很容易就能处理图片的各种效 ...

  5. iOS:iOS开发系列–打造自己的“美图秀秀”(下)

    来源: KenshinCui 链接:http://www.cnblogs.com/kenshincui/p/3959951.html 运行效果: 其他图形上下文 前面我们也说过,Quartz 2D的图 ...

  6. Qt Quick 图像处理实例之美图秀秀(附源代码下载)

    在<Qt Quick 之 QML 与 C++ 混合编程具体解释>一文中我们解说了 QML 与 C++ 混合编程的方方面面的内容,这次我们通过一个图像处理应用.再来看一下 QML 与 C++ ...

  7. PHP流式上传和表单上传(美图秀秀)

    最近需要开发一个头像上传的功能,找了很多都需要授权的,后来找到了美图秀秀,功能非常好用. <?php /** * Note:for octet-stream upload * 这个是流式上传PH ...

  8. 利用Photos 框架搭建美图秀秀相册选择器

    简介:Photos框架是iOS8.0后推出的一个新的用于对系统相册进行相关操作的,在iOS8.0之前,开发中只能使用AssetsLibrary框架来访问移动设备的图片库.本文中不再对AssetsLib ...

  9. thinkphp + 美图秀秀api 实现图片裁切上传,带数据库

    思路: 1.数据库 创建test2 创建表img,字段id,url,addtime 2.前台页: 1>我用的是bootstrap 引入必要的js,css 2>引入美图秀秀的js 3.后台: ...

随机推荐

  1. [Go] md5 加密 示例

    package main import ( "crypto/md5" "encoding/hex" "fmt" "io" ...

  2. [Go] Template 使用简介

    Golang 提供了两个标准库用来处理模板 text/template 和 html/template.我们使用 html/template 格式化 html 字符. 模板引擎 模板引擎很多,Pyth ...

  3. HDU 1428 漫步校园 (BFS+优先队列+记忆化搜索)

    题目地址:HDU 1428 先用BFS+优先队列求出全部点到机房的最短距离.然后用记忆化搜索去搜. 代码例如以下: #include <iostream> #include <str ...

  4. Mybatis配置返回为修改影响条数

    mybatis配置返回为修改影响条数,修改jdbc连接如下即可:添加useAffectedRows=true配置. jdbc:mysql://jdbc.host/{jdbc.db}?useAffect ...

  5. Java Calendar,Date,DateFormat,TimeZone,Locale等时间相关内容的认知和使用(5) SimpleDateFormat

    本章介绍SimpleDateFormat. SimpleDateFormat 介绍 SimpleDateFormat 是一个格式化Date 以及 解析日期字符串 的工具.它的最常用途是,能够按照指定的 ...

  6. 【python】安装Python 的IDE--PyCharm

    [百度网盘-技术-pycharm破解需要的有安装包和破解jar] ================================================== 安装Tensorflow开发环境 ...

  7. C++关键字之virtual

    from://http://blog.csdn.net/xuyuanfan/article/details/9935533 在C++中是没有接口的,要真正实现java中的interface功能,需要使 ...

  8. windows 下运行 UglifyJS

    Node 0.52版本支持windows,因此UglifyJS可以在windows上运行,下面简介他的方法: 1.下载node.exe,现在最新版本0.52,他的官网http://nodejs.org ...

  9. 2016 移动应用质量大数据报告--转自腾讯Bugly

    2016年,在“互联网+”战略的推动下,移动互联网与越来越多传统行业的结合更加紧密,用户使用移动互联网的工作场景.生活场景.消费场景都在悄然发生着改变, 移动互联网产品在智能硬件.医疗.汽车.旅游.教 ...

  10. Prometheus 初体验

    本文环境 Redhat Linux 6.7, Prometheus 2.2.1,node_exporter 1.5.2 介绍 Prometheus 是2012年由 SoundCloud 开源的系统监控 ...