HUAutoLayoutiOS布局自動排版
HUAutoLayout
根據(jù)給定的數(shù)據(jù)量,進(jìn)行自動排版.
使用方法
實例化布局對象
HUAutoLayout *layout = [HUAutoLayout sharedLayout];
為布局對象賦值
NSUInteger culomn; //!< 屬性描述: 列數(shù) NSUInteger line; //!< 屬性描述: 行數(shù) UIEdgeInsets contentInset; //! <屬性描述: 內(nèi)邊距 CGFloat minimumInteritemSpacing; //!< 屬性描述: 列間距 CGFloat minimumLineSpacing; //!< 屬性描述: 行間距 CGSize itemSize; //!< 屬性描述: 尺寸
九宮格自動布局
- (void) hu_layoutSquare:(UIView *)targetView layoutCount:(NSInteger)count layoutType:(HUAutoLayoutSquareType)type handleBlock:(HUAutoLayoutHandleBlock)handleBlock;
垂直方向上流水布局 必須設(shè)定 itemHeight, culomn 和 itemWidth 至少一個需給定數(shù)據(jù).
水平方向上流水布局 必須設(shè)定 itemWidth, line 和 itemHeight 至少一個需給定數(shù)據(jù).
限定范圍內(nèi)固定布局 line, culomn, itemWidth, itemHeight 至少一個需給定數(shù)據(jù).
瀑布流自動布局
必須先需要設(shè)置代理 waterfallDelegate.
- (void) hu_layoutWaterfall:(UIView *)targetView layoutCount:(NSInteger)count layoutType:(HUAutoLayoutWaterfallType)type handleBlock:(HUAutoLayoutHandleBlock)handleBlock;
垂直方向上流水布局 culomn 和 itemWidth 至少設(shè)置一個. 需實現(xiàn)代理方法:
- (CGFloat)layoutForItemHeight:(CGFloat)itemWith index:(NSUInteger)index;
水平方向上流水布局 line 和 itemHeight 至少一個需給定數(shù)據(jù). 需實現(xiàn)代理方法:
- (CGFloat)layoutForItemWidth:(CGFloat)itemHeight index:(NSUInteger)index;
demo演示
本demo請用: 模擬器6和6s運(yùn)行,其它屏幕未作適配.
//注釋: demo中九宮格布局使用的是plist文件中的假數(shù)據(jù),設(shè)置 布局?jǐn)?shù)量 無用.
交流郵箱
[email protected], 歡迎交流.
評論
圖片
表情
