iOS布局自动排版 HUAutoLayout

码农软件 · 软件分类 · 视图布局(View Layout) · 2019-06-22 10:59:19

软件介绍

HUAutoLayout

根据给定的数据量,进行自动排版.

使用方法

实例化布局对象

  HUAutoLayout *layout = [HUAutoLayout sharedLayout];

为布局对象赋值

  NSUInteger culomn;               //!< 属性描述: 列数  
  NSUInteger line;                 //!< 属性描述: 行数
  UIEdgeInsets contentInset;       //! <属性描述: 内边距
  CGFloat minimumInteritemSpacing; //!< 属性描述: 列间距
  CGFloat minimumLineSpacing;      //!< 属性描述: 行间距
  CGSize itemSize;                 //!< 属性描述: 尺寸

九宫格自动布局

  - (void) hu_layoutSquare:(UIView *)targetView layoutCount:(NSInteger)count layoutType:(HUAutoLayoutSquareType)type handleBlock:(HUAutoLayoutHandleBlock)handleBlock;
  • 垂直方向上流水布局 必须设定 itemHeight, culomn 和 itemWidth 至少一个需给定数据.

  • 水平方向上流水布局 必须设定 itemWidth, line 和 itemHeight 至少一个需给定数据.

  • 限定范围内固定布局 line, culomn, itemWidth, itemHeight 至少一个需给定数据.

瀑布流自动布局

  • 必须先需要设置代理 waterfallDelegate.

  - (void) hu_layoutWaterfall:(UIView *)targetView layoutCount:(NSInteger)count layoutType:(HUAutoLayoutWaterfallType)type handleBlock:(HUAutoLayoutHandleBlock)handleBlock;
  • 垂直方向上流水布局 culomn 和 itemWidth 至少设置一个. 需实现代理方法:

  - (CGFloat)layoutForItemHeight:(CGFloat)itemWith index:(NSUInteger)index;
  • 水平方向上流水布局 line 和 itemHeight 至少一个需给定数据. 需实现代理方法:

  - (CGFloat)layoutForItemWidth:(CGFloat)itemHeight index:(NSUInteger)index;

demo演示

本demo请用: 模拟器6和6s运行,其它屏幕未作适配.

  //注释: demo中九宫格布局使用的是plist文件中的假数据,设置 布局数量 无用.

自动排版演示1  自动排版演示2

交流邮箱

huxiaoluder@163.com, 欢迎交流.

本文地址:https://codercto.com/soft/d/8520.html

Unreal Engine 4 Scripting with C++ Cookbook

Unreal Engine 4 Scripting with C++ Cookbook

Sherif, William、Stephen Whittle / 2016-10-24

Unreal Engine 4 (UE4) is a complete suite of game development tools made by game developers, for game developers. With more than 100 practical recipes, this book is a guide showcasing techniques to us......一起来看看 《Unreal Engine 4 Scripting with C++ Cookbook》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

html转js在线工具
html转js在线工具

html转js在线工具