__weak typeof(self) weakSelf = self;

    UIView * tempView = [[UIView alloc]init];
NSInteger count = ;//设置一排view的个数
NSInteger margin = ;//设置相隔距离
NSInteger height = ;//设置view的高度
for (int i = ; i < count; i ++) {
UIView * view = [[UIView alloc]init];
view.backgroundColor = [UIColor brownColor];
[self.view addSubview:view];
if (i == ) {
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.view).offset(margin);
make.centerY.equalTo(weakSelf.view);
make.height.mas_equalTo(height);
}];
}
else if (i == count - ){
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(weakSelf.view).offset(-margin);
make.left.equalTo(tempView.mas_right).offset(margin);
make.centerY.equalTo(tempView);
make.height.equalTo(tempView);
make.width.equalTo(tempView);
}];
}
else{
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(tempView.mas_right).offset(margin);
make.centerY.equalTo(tempView);
make.height.equalTo(tempView);
make.width.equalTo(tempView);
}];
}
tempView = view;
[view layoutIfNeeded];
}

最新文章

  1. copy()之绝版应用
  2. const 与 readonly知多少
  3. Linux Shell脚本编程--Head/Tail命令详解
  4. ubuntu安装opencv
  5. PHP取整函数:ceil,floor,round,intval的区别详细解析
  6. 解决错误 Cannot await in the body of a catch clause
  7. iOS 7 UI Transition – Porting View Controller Layouts from iOS 6
  8. BZOJ1103[POI2007]大都市meg 题解
  9. PSAM卡与CPU(用户卡)的操作过程
  10. Spring mvc中@RequestMapping 6个基本用法整理
  11. Django入门笔记
  12. PKU《程序设计》专项课程_递归汉诺塔问题
  13. WorkStation 虚拟机迁移到 ESXi的后续处理.
  14. strstr(),strchr()
  15. Oracle性能诊断艺术-读书笔记(执行计划中显示 Starts, E-Rows, REM A-Rows and A-Time)等)
  16. python学习之RabbitMQ-----消息队列
  17. oracle 导入导出 dmp 的三种方式
  18. PLSA-概率潜语义分析(二)
  19. PLSQL启动很慢的问题
  20. 您必须先调用“WebSecurity.InitializeDatabaseConnection”方法,然后再调用&quot;WebSecurity&quot;类的任何其他方法。

热门文章

  1. PHP中$a &amp;&amp; $b = $c 语法的用法
  2. 关于一个flask的服务接口实战(flask-migrate,flask-script,SQLAlchemy)
  3. hadoop的自定义分组实现 (Partition机制)
  4. 嵌入式LInux之C语言提升篇---Skr Skr Up Up
  5. Fibonacci递归以及数组实现
  6. 实验4 [BX]和loop指令
  7. CSS布局遇到的问题小结
  8. LeetCode: 61. Rotate List(Medium)
  9. springboot shiro没有注解解决方案
  10. android 学习六 构建用户界面和使用控件