使用Masonry排列多个控件

Masonry实现九宫格布局 知识点: 1.masonry 2.NSArray分类实现 NSArray+Sudoku.h #import "MASUtilities.h" #import "MASConstraintMaker.h" #import "MASViewAttribute.h" #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BE... 阅读详情

使用Masonry排列多个控件

1. 单排、单列

知识点:

1.masonry

2.NSArray分类实现

NSArray+Sudoku.h


#import "MASUtilities.h"
#import "MASConstraintMaker.h"
#import "MASViewAttribute.h"
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSArray (Sudoku)

/**
 *  九宫格布局 固定ItemSize 可变ItemSpacing
 *
 *  @param fixedItemWidth  固定宽度
 *  @param fixedItemHeight 固定高度
 *  @param warpCount       折行点
 *  @param topSpacing      顶间距
 *  @param bottomSpacing   底间距
 *  @param leadSpacing     左间距
 *  @param tailSpacing     右间距
 */
- (void)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth
                                    fixedItemHeight:(CGFloat)fixedItemHeight
                                          warpCount:(NSInteger)warpCount
                                         topSpacing:(CGFloat)topSpacing
                                      bottomSpacing:(CGFloat)bottomSpacing
                                        leadSpacing:(CGFloat)leadSpacing
                                        tailSpacing:(CGFloat)tailSpacing;


/**
 *  九宫格布局 可变ItemSize 固定ItemSpacing
 *
 *  @param fixedLineSpacing      行间距
 *  @param fixedInteritemSpacing 列间距
 *  @param warpCount             折行点
 *  @param topSpacing            顶间距
 *  @param bottomSpacing         底间距
 *  @param leadSpacing           左间距
 *  @param tailSpacing           右间距
 */
- (void)mas_distributeSudokuViewsWithFixedLineSpacing:(CGFloat)fixedLineSpacing
                                fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing
                                            warpCount:(NSInteger)warpCount
                                           topSpacing:(CGFloat)topSpacing
                                        bottomSpacing:(CGFloat)bottomSpacing
                                          leadSpacing:(CGFloat)leadSpacing
                                          tailSpacing:(CGFloat)tailSpacing;


/**
 *  九宫格布局 固定ItemSize 固定ItemSpacing
 *  可由九宫格的内容控制SuperView的大小
 *  如果warpCount大于[self count],该方法将会用空白的View填充到superview中
 *
 *  Sudoku Layout, has fixed item size, and fix item space
 *  If warp count greater than self.count, It's fill empty view to superview
 *
 *  @param fixedItemWidth        固定宽度,如果设置成0,则表示自适应,If set it to zero, indicates the adaptive.
 *  @param fixedItemHeight       固定高度,如果设置成0,则表示自适应,If set it to zero, indicates the adaptive.
 *  @param fixedLineSpacing      行间距
 *  @param fixedInteritemSpacing 列间距
 *  @param warpCount             折行点
 *  @param topSpacing            顶间距
 *  @param bottomSpacing         底间距
 *  @param leadSpacing           左间距
 *  @param tailSpacing           右间距
 *
 *  @return 一般情况下会返回[self copy], 如果warpCount大于[self count],则会返回一个被空白view填充过的数组,可以让你循环调用removeFromSuperview或者干一些其他的事情;
 *  @return Normal will return [self copy], If warpCount bigger than [self count] , It will return a empty views filled array, you could enumerate [subview removeFromSuperview] or do other things;
 */
- (NSArray *)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth
                                         fixedItemHeight:(CGFloat)fixedItemHeight
                                        fixedLineSpacing:(CGFloat)fixedLineSpacing
                                   fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing
                                               warpCount:(NSInteger)warpCount
                                              topSpacing:(CGFloat)topSpacing
                                           bottomSpacing:(CGFloat)bottomSpacing
                                             leadSpacing:(CGFloat)leadSpacing
                                             tailSpacing:(CGFloat)tailSpacing;
@end

NS_ASSUME_NONNULL_END

NSArray+Sudoku.m


#import "NSArray+Sudoku.h"
#import "View+MASAdditions.h"


@implementation NSArray (Sudoku)
- (MAS_VIEW *)star_commonSuperviewOfViews {
    
    if (self.count == 1) {
        return ((MAS_VIEW *)self.firstObject).superview;
    }
    
    MAS_VIEW *commonSuperview = nil;
    MAS_VIEW *previousView = nil;
    for (id object in self) {
        if ([object isKindOfClass:[MAS_VIEW class]]) {
            MAS_VIEW *view = (MAS_VIEW *)object;
            if (previousView) {
                commonSuperview = [view mas_closestCommonSuperview:commonSuperview];
            } else {
                commonSuperview = view;
            }
            previousView = view;
        }
    }
    NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy.");
    return commonSuperview;
}



- (void)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth
                                    fixedItemHeight:(CGFloat)fixedItemHeight
                                          warpCount:(NSInteger)warpCount
                                         topSpacing:(CGFloat)topSpacing
                                      bottomSpacing:(CGFloat)bottomSpacing
                                        leadSpacing:(CGFloat)leadSpacing
                                        tailSpacing:(CGFloat)tailSpacing {
    if (self.count < 2) {
        NSAssert(self.count>1,@"views to distribute need to bigger than one");
        return;
    }
    if (warpCount < 1) {
        NSAssert(false, @"warp count need to bigger than zero");
        return;
    }
    
    MAS_VIEW *tempSuperView = [self star_commonSuperviewOfViews];
    
    NSInteger rowCount = self.count % warpCount == 0 ? self.count / warpCount : self.count / warpCount + 1;
    
    MAS_VIEW *prev;
    for (int i = 0; i < self.count; i++) {
        
        MAS_VIEW *v = self[i];
        
        // 当前行
        NSInteger currentRow = i / warpCount;
        // 当前列
        NSInteger currentColumn = i % warpCount;
        
        [v mas_makeConstraints:^(MASConstraintMaker *make) {
            // 固定宽度
            make.width.equalTo(@(fixedItemWidth));
            make.height.equalTo(@(fixedItemHeight));
            
            // 第一行
            if (currentRow == 0) {
                make.top.equalTo(tempSuperView).offset(topSpacing);
            }
            // 最后一行
            if (currentRow == rowCount - 1) {
                make.bottom.equalTo(tempSuperView).offset(-bottomSpacing);
            }
            // 中间的若干行
            if (currentRow != 0 && currentRow != rowCount - 1){
                CGFloat offset = (1-(currentRow/((CGFloat)rowCount-1)))*(fixedItemHeight+topSpacing)-currentRow*bottomSpacing/(((CGFloat)rowCount-1));
                make.bottom.equalTo(tempSuperView).multipliedBy(currentRow/((CGFloat)rowCount-1)).offset(offset);
            }
            
            // 第一列
            if (currentColumn == 0) {
                make.left.equalTo(tempSuperView).offset(leadSpacing);
            }
            // 最后一列
            if (currentColumn == warpCount - 1) {
                make.right.equalTo(tempSuperView).offset(-tailSpacing);
            }
            // 中间若干列
            if (currentColumn != 0 && currentColumn != warpCount - 1) {
                CGFloat offset = (1-(currentColumn/((CGFloat)warpCount-1)))*(fixedItemWidth+leadSpacing)-currentColumn*tailSpacing/(((CGFloat)warpCount-1));
                make.right.equalTo(tempSuperView).multipliedBy(currentColumn/((CGFloat)warpCount-1)).offset(offset);
            }
        }];
        prev = v;
    }
}

- (void)mas_distributeSudokuViewsWithFixedLineSpacing:(CGFloat)fixedLineSpacing
                                fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing
                                            warpCount:(NSInteger)warpCount
                                           topSpacing:(CGFloat)topSpacing
                                        bottomSpacing:(CGFloat)bottomSpacing
                                          leadSpacing:(CGFloat)leadSpacing
                                          tailSpacing:(CGFloat)tailSpacing {
    
    [self mas_distributeSudokuViewsWithFixedItemWidth:0 fixedItemHeight:0 fixedLineSpacing:fixedLineSpacing fixedInteritemSpacing:fixedInteritemSpacing warpCount:warpCount topSpacing:topSpacing bottomSpacing:bottomSpacing leadSpacing:leadSpacing tailSpacing:tailSpacing];
}

- (NSArray *)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth
                                         fixedItemHeight:(CGFloat)fixedItemHeight
                                        fixedLineSpacing:(CGFloat)fixedLineSpacing
                                   fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing
                                               warpCount:(NSInteger)warpCount
                                              topSpacing:(CGFloat)topSpacing
                                           bottomSpacing:(CGFloat)bottomSpacing
                                             leadSpacing:(CGFloat)leadSpacing
                                             tailSpacing:(CGFloat)tailSpacing {
    if (self.count < 1) {
        return self.copy;
    }
    if (warpCount < 1) {
        NSAssert(false, @"warp count need to bigger than zero");
        return self.copy;
    }
    
    MAS_VIEW *tempSuperView = [self star_commonSuperviewOfViews];
    
    NSArray *tempViews = self.copy;
    if (warpCount > self.count) {
        for (int i = 0; i < warpCount - self.count; i++) {
            MAS_VIEW *tempView = [[MAS_VIEW alloc] init];
            [tempSuperView addSubview:tempView];
            tempViews = [tempViews arrayByAddingObject:tempView];
        }
    }
    
    NSInteger columnCount = warpCount;
    NSInteger rowCount = tempViews.count % columnCount == 0 ? tempViews.count / columnCount : tempViews.count / columnCount + 1;
    
    MAS_VIEW *prev;
    for (int i = 0; i < tempViews.count; i++) {
        
        MAS_VIEW *v = tempViews[i];
        NSInteger currentRow = i / columnCount;
        NSInteger currentColumn = i % columnCount;
        
        [v mas_makeConstraints:^(MASConstraintMaker *make) {
            if (prev) {
                // 固定宽度
                make.width.equalTo(prev);
                make.height.equalTo(prev);
            }
            else {
                // 如果写的item高宽分别是0,则表示自适应
                if (fixedItemWidth) {
                    make.width.equalTo(@(fixedItemWidth));
                }
                if (fixedItemHeight) {
                    make.height.equalTo(@(fixedItemHeight));
                }
            }
            
            // 第一行
            if (currentRow == 0) {
                make.top.equalTo(tempSuperView).offset(topSpacing);
            }
            // 最后一行
            if (currentRow == rowCount - 1) {
                // 如果只有一行
                if (currentRow != 0 && i-columnCount >= 0) {
                    make.top.equalTo(((MAS_VIEW *)tempViews[i-columnCount]).mas_bottom).offset(fixedLineSpacing);
                }
                make.bottom.equalTo(tempSuperView).offset(-bottomSpacing);
            }
            // 中间的若干行
            if (currentRow != 0 && currentRow != rowCount - 1) {
                make.top.equalTo(((MAS_VIEW *)tempViews[i-columnCount]).mas_bottom).offset(fixedLineSpacing);
            }
            
            // 第一列
            if (currentColumn == 0) {
                make.left.equalTo(tempSuperView).offset(leadSpacing);
            }
            // 最后一列
            if (currentColumn == columnCount - 1) {
                // 如果只有一列
                if (currentColumn != 0) {
                    make.left.equalTo(prev.mas_right).offset(fixedInteritemSpacing);
                }
                make.right.equalTo(tempSuperView).offset(-tailSpacing);
            }
            // 中间若干列
            if (currentColumn != 0 && currentColumn != warpCount - 1) {
                make.left.equalTo(prev.mas_right).offset(fixedInteritemSpacing);
            }
        }];
        prev = v;
    }
    return tempViews;
}
@end

3.需求实现:

  // 设置间隔宽度,item宽度自适应
    UIView *bg = [UIView new];
    [self.view addSubview:bg];
    [bg mas_makeConstraints:^(MASConstraintMaker *make) {
        if (@available(iOS 11.0, *)) {
            make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
        } else {
            make.top.equalTo(self.view.mas_topMargin);
        }
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(100);
    }];
    
    NSArray *titleAry = @[@"间",@"隔",@"固",@"定"];
    NSMutableArray *btns = [NSMutableArray new];
    [titleAry enumerateObjectsUsingBlock:^(NSString   * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *btn = [UIButton new];
        [btn setTitle:obj forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize:18];
        btn.backgroundColor = [UIColor cyanColor];
        [bg addSubview:btn];
        [btns addObject:btn];
        
    }];
    [btns mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:10 leadSpacing:0 tailSpacing:0];
    [btns mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.height.equalTo(bg);
    }];
    
   // 设置item宽度,间隙宽度自适应
    UIView *bg2 = [UIView new];
    [self.view addSubview:bg2];
    [bg2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bg.mas_bottom).offset(20);
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(100);
    }];
    NSArray *titleAry2 = @[@"宽",@"度",@"固",@"定"];
    NSMutableArray *btns2 = [NSMutableArray new];
    [titleAry2 enumerateObjectsUsingBlock:^(NSString   * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *btn = [UIButton new];
        [btn setTitle:obj forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize:18];
        btn.backgroundColor = [UIColor blueColor];
        [bg2 addSubview:btn];
        [btns2 addObject:btn];
        
    }];
    
    [btns2 mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedItemLength:80 leadSpacing:20 tailSpacing:50];
    [btns2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.height.equalTo(bg2);
    }];
    
    // 设置间隔宽度,item高度自适应
    UIView *bg3 = [UIView new];
    [self.view addSubview:bg3];
    [bg3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bg2.mas_bottom).offset(20);
        make.centerX.equalTo(self.view);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(100 * 4);
    }];
    NSArray *titleAry3 = @[@"间",@"隔",@"固",@"定"];
    NSMutableArray *btns3 = [NSMutableArray new];
    [titleAry3 enumerateObjectsUsingBlock:^(NSString   * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *btn = [UIButton new];
        [btn setTitle:obj forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize:18];
        btn.backgroundColor = [UIColor brownColor];
        [bg3 addSubview:btn];
        [btns3 addObject:btn];
        
    }];
    
    [btns3 mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedSpacing:10 leadSpacing:30 tailSpacing:0];
    [btns3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.width.equalTo(bg3);
    }];

 

LVDS高速ADC接口, xilinx fpga实现 FPGA实现lvds高速ADC数据接口,窗口对齐算法,Verilog源码 阅读详情

相关推荐

别再手搓SVG了!用Vue3+SVG.js快速搭建电力系统拓扑图(附完整代码)

本文介绍了如何利用Vue3和SVG.js实现电力系统拓扑图的低代码开发,通过组件化和响应式数据绑定,大幅提升开发效率。文章详细解析了SVG.js的核心功能,包括图形创建链式API、动态属性绑定和高级图形操作,并提供了断路器组件的完整实现代码。此外,还分享了性能优化策略和调试技巧,帮助开发者应对大规模拓扑图的挑战。

weixin_27717759的博客 354

iOS - Masonry 使用中的一些整理

个人喜欢用纯代码写东西,其中用到最多的就是Masonry,我整理一些使用过程中一些点,方便以后使用.(基本的语法就不说了)首先说几点:我一般将数值类型的约束用mas_equalTo,而相对于某个控件,或者某个控件的某个约束,我会使用equalTo,如: make.size.mas_equalTo(CGSizeMake(100, 100)); make.center.equalTo(weakSel

songbai1211的专栏 1535

Diffusion:如何从噪声中生成清晰图像

扩散模型是当前AI图像生成领域的核心基础,如Stable Diffusion、DALL·E等热门模型均采用该技术。其原理分为训练和推理两个阶段:训练时通过逐步加噪图片,让AI学习如何去除噪声;推理时则从随机噪声出发,结合文本提示逐步去噪生成清晰图像。模型架构通常包含文本编码器、生成模型(如U-Net)和解码器三部分,通过多轮迭代将低维潜在空间表示转化为最终图像。这种技术模拟了艺术家从混沌中雕琢作品的过程,实现了从随机噪声到目标图像的智能生成。

laumy的学习笔记 1278

Masonry 等间隔或等宽高排列多个控件

- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. _masonryViewArray = [NSMutableArray array]; for (int i = 0; i&...

weixin_33892359的博客 438

PyCharm 2023最新版安装配置全攻略(附永久激活教程)

本文详细介绍了PyCharm 2023最新版的安装配置全流程,包括版本选择、初始配置、插件生态、工程模板、调试优化及团队协作等关键步骤。特别针对专业版和社区版的功能差异进行对比,帮助开发者高效搭建Python开发环境,提升编码效率与团队协作能力。

p4q5r6s7t的博客 880

笔试题-2023-紫光展锐-数字芯片设计【纯净题目版】

笔试题-2023-紫光展锐-数字芯片设计【纯净题目版】

w0shishabi的博客 2926

iOS Masonry实现多个Button对齐布局

在iOS开发的时候可能会碰到一个问题、并排的多个Button 我们不知道怎么用Masonry去实现、下面就是用Masonry去实现的- (void)setTitleArr:(NSArray *)titleArr { NSMutableArray *arrayMut = [NSMutableArray array]; for (int i = 0; i&lt;titleArr.c...

weixin_38921307的博客 6430

让 ABAP 开发者也能做出高质量 SAP Fiori:到底需要掌握多少前端知识?

文章摘要: 随着SAP技术演进,ABAP开发者的角色边界正在重构。传统SAP GUI时代的全栈开发模式逐渐转向RAP+Fiori Elements的新范式,其中关键技术变化包括: 开发模式转变:从前后端耦合转向RAP模型驱动开发,通过CDS注解实现UI意图表达 分工优化:Fiori Elements模板处理80%标准UI需求,Flexible Programming Model解决20%差异化需求 效率提升:注解驱动开发可在RAP建模阶段同步定义UI结构,大幅缩短交付周期 工具整合:SAP提供从建模到部署的

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 350

masonry使用方法,masonry布局多控件横向或纵向一次性布局

使用Masonry进行横向或者纵向的多控件的规律性布局。  使用: [viewArr mas_distributeViewsAlongAxis: withFixedSpacing: leadSpacing: tailSpacing:];[viewArr mas_distributeViewsAlongAxis: withFixedItemLength: leadSpacing: tailS

PorGer333的博客 2718

Qt QTableView排序

在开发过程中,我们需要通过点击表头来对QTableView或QTreeView等一系列高级视图进行排序操作,以下是进行排序的步骤。首先创建了一个QStandardItemModel对象或者继承QAbstractTableModel类作为数据模型,并设置了一些数据。然后创建一个QTableView对象,并将数据模型设置为其模型。接下来,创建一个QSortFilterProxyModel对象,并将QStandardItemModel对象设置为其源模型。然后设置QTableView开启排序功能。

希望能帮助大家,希望大家多多支持,你们的支持是我前进的动力。 2646

halcon知识:常见三种模板匹配方法总结

halcon的三种模板匹配方法总结,halcon有三种模板匹配方法:即Component-Based、Gray-Value-Based、Shaped_based,分别是基于组件(或成分、元素)的匹配,基于灰度值的匹配和基于形状的匹配,此外还有变形匹配和三维模型匹配也是分属于前面的大类 本文只对形状匹配做简要说明和补充: Shape_Based匹配方法: 上图介绍的是形状匹配做法的一般流程及模板制作的两种方法。 先要补充点知识:形状匹配常见的有四种情况 一般形状匹配模板shape_model、线性变

gongdiwudu的专栏 4万+

Masonry多个控件的等间隔排序显示

多个(2个以上)控件的等间隔排序显示 首先介绍2个函数 /** * axisType 轴线方向 * fixedSpacing 间隔大小 * fixedItemLength 每个控件的固定长度/宽度 * leadSpacing 头部间隔 * tailSpacing 尾部间隔 *

lzylzy1991的专栏 6682

Vue3 - Element Plus 表格组件 el-table “表格行数据中又嵌套了二维对象数组“,按平级循环渲染(嵌套数组视为同级行数据), 对嵌套的数组循环展示为表格,智能合并行或列详细教程

vue3,nuxt3,element-plus,table表格组件,el-table,vue3element表格组件,数据中有二维数组怎么遍历循环显示,表格数据带二级数组怎么循环渲染显示,表格数据中存在一个数组要怎么才能显示到表格,el-table表格合并详细教程示例,table表格如果对象里面还有对象数组那该怎么去渲染,平常都是数组中一个对象渲染成一行,每行中还有嵌套数组怎么办,每个行数据下还有一个数组怎么显示,怎么把表格相同的数据合并为一行,合并上下两行相同数据单元格,合并行或列如果遇到相同单元格就合

🏆 前端领域优质创作者 1万+

iOS Masonry 等间隔或等宽高排列多个控件

https://www.jianshu.com/p/25977be007f7 masonry目前提供了相应的接口,直接使用即可,这里记录或许可以提醒某些不知道的人罢了! 一、先解释相关API /** * distribute with fixed spacing * * @param axisType 横排还是竖排 * @param fixedSpacing 两个...

sundaysme的博客 1145

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

数字 等宽 ios html5,iOS Masonry 等间隔或等宽高排列多个控件

masonry 目前提供了相应的接口,直接使用即可,这里记录或许可以提醒某些不知道的人罢了!一、先解释相关API/*** distribute with fixed spacing** @param axisType 横排还是竖排* @param fixedSpacing 两个控件间隔* @param leadSpacing 第一个控件与边缘的间隔* @param tailSp...

weixin_29204749的博客 237

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

ios 使用Masonary创建等间距排列的控件

UIView *backView = [[UIView alloc] init]; backView.backgroundColor = [UIColor grayColor]; [self.view addSubview:backView]; [backView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.view); make.top.

fsdf1151的博客 488

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

masonry的等间隔排列

/**  * axisType 轴线方向   * fixedSpacing 间隔大小   * fixedItemLength 每个控件的固定长度/宽度  * leadSpacing 头部间隔   * tailSpacing 尾部间隔 * */// 1. 等间隔排列 - 多个控件间隔固定,控件长度/宽度变化 - (void)mas_distributeViewsAlon

u013712343的博客 1076

iOS Masonry控件等比例\等间距布局

一、先解释相关API 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 /**  *  distribute with fixed spacing  *  *  @pa...

cybtop的博客 6103

Masonry的使用

Masonry简介 Masonry是一个轻量级的布局框架,它拥有自己的描述语法(采用更优雅的链式语法封装)来自动布局,具有很好可读性且同时支持iOS和Max OS X等。 总之,对于侧重写代码的coder,请你慢慢忘记Frame,喜欢Masonry吧 使用前的准备 若是你对于自动布局很熟练的话,再接触这个第三方Masonry很容易上手的,对UI界面显示的控件的约束本质都是相同的

博客-ZhangYaXun 774

iOS Mansory 等间隔或等宽高排列多个控件

masonry 目前提供了相应的接口,直接使用即可,这里记录或许可以提醒某些不知道的人罢了! 一、先解释相关API /** *distributewithfixedspacing * *@paramaxisType横排还是竖排 *@paramfixedSpacing两个控件间隔 *@paramleadSpacing第一个控件与边缘的间...

ForeverMyheart的博客 889

masonry多个平均布局

/首先添加5个视图   NSMutableArray *array = [NSMutableArray new];      for (int i = 0; i &lt; 5; i ++) {          UIView *view = [UIView new];          view.backgroundColor = [UIColor greenColor];          [s...

shangpuzhuan8492的博客 3959

Masonry 使用中的一些整理

个人喜欢用纯代码写东西,其中用到最多的就是Masonry,我整理一些使用过程中一些点,方便以后使用.(基本的语法就不说了) 首先说几点: 我一般将数值类型的约束用mas_equalTo,而相对于某个控件,或者某个控件的某个约束,我会使用equalTo,如: make.size.mas_equalTo(CGSizeMake(100, 100)); make.center.equalT

Zgbin的博客 304

IOS 自动布局Auto Layout,masonry

文章目录简介工作原理Masonry安装Masonry常用方法Masonry中定义的关系举例 简介 在苹果推出iPhone5之前,苹果的屏幕分辨率只有一种,因此对于iOS开发者来说,是不需要像Android工程师一样去考虑屏幕适配问题的。但随着iPhone5的发布,iPhone的屏幕出现了3.5寸和4.0寸两种尺寸,这种情况下,仍然可以分别为两种尺寸编写各自的界面布局样式,但随着iPhone6以及i...

煮酒Shae 852

使用Masonry实现等间距布局

这里写自定义目录标题欢迎使用Markdown编辑器视图自适应宽度(高度)功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入...

我叫柱子哥 1942
上一篇: scrollview中使用masory
下一篇: Masonry实现九宫格布局
RockyFung
博客等级 码龄11年 3粉丝 25原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值