包括: StarView星星评价(支持半星, 整星, 任意星, 支持拖动, 支持自定义星星图片, 数量, 大小, 间距, 最低分值). 瀑布流(垂直, 浮动, 混合模式瀑布流)等.
可直接下载demo, 将ZZTools文件夹拖入工程中使用.
cocoapods集成可使用: pod 'ZZTools' , 若搜索不到可尝试先使用pod setup.
好用的话, 记得留下你的小星星哦!
#import "ZZTools.h"
ZZLayout *layout = [[ZZLayout alloc] initWith:ZZLayoutFlowTypeVertical delegate:self];
/**cell的宽(垂直瀑布流时此协议方法无效, 根据columnNumber和各种间距自适应)*/
- (CGFloat)layout:(ZZLayout *)layout widthForRowAtIndexPath:(NSIndexPath *)indexPath;
/**cell的高(水平瀑布流是此协议方法无效, 根据columnNumber和各种间距自适应)*/
- (CGFloat)layout:(ZZLayout *)layout heightForRowAtIndexPath:(NSIndexPath *)indexPath;
/**每个区多少列(浮动瀑布流时时此协议方法无效)*/
- (NSInteger)layout:(ZZLayout *)layout columnNumberAtSection:(NSInteger)section;
/**每个区的边距(上左下右)*/
- (UIEdgeInsets)layout:(ZZLayout *)layout insetForSectionAtIndex:(NSInteger)section;
/**多种类型混合, 暂不支持水平, 可随意兼容垂直和浮动效果*/
- (ZZLayoutFlowType)layout:(ZZLayout *)layout layoutFlowTypeForSectionAtIndex:(NSInteger)section;
/**每个item行间距(如果为水平方向瀑布流, 这里则是左右间距)*/
- (NSInteger)layout:(ZZLayout *)layout lineSpacingForSectionAtIndex:(NSInteger)section;
/**每个item列间距(如果是水平方向瀑布流, 这里则是上下间距)*/
- (CGFloat)layout:(ZZLayout *)layout interitemSpacingForSectionAtIndex:(NSInteger)section;
/**header的size*/
- (CGSize)layout:(ZZLayout *)layout referenceSizeForHeaderInSection:(NSInteger)section;
/**footer的size*/
- (CGSize)layout:(ZZLayout *)layout referenceSizeForFooterInSection:(NSInteger)section;
/**本区区头和上个区区尾的间距*/
- (CGFloat)layout:(ZZLayout *)layout spacingWithLastSectionForSectionAtIndex:(NSInteger)section;
/**指定某个分区的"背景"颜色(从区头, 到区尾的空间, 不包含区头区尾)*/
- (UIColor *)layout:(ZZLayout *)layout colorForSection:(NSInteger)section;
//starView是一个ZZStarView类型的属性, 请自行实现
self.starView = [[ZZStarView alloc] initWithImage:[UIImage imageNamed:@"star"] selectImage:[UIImage imageNamed:@"didStar"] starWidth:20 starHeight:20 starMargin:5 starCount:5 callBack:^(CGFloat userGrade, CGFloat finalGrade) {
NSLog(@"用户实际选择分 === %.2f, 最终分 === %.2f", userGrade, finalGrade);
}];
//此view宽高自适应, 设置frame时, 只需考虑q起点xy坐标
[self.view addSubview:self.starView];
self.starView.frame = CGRectMake(50, 150, self.starView.bounds.size.width, self.starView.bounds.size.height);
self.starView.sublevel = 0.5;//默认值, 可以不写, 用户可选分值范围是0.5的倍数.(建议在设置分值之前确定此值)
self.starView.grade = [self.params[@"grade1"] floatValue];//设置分值, 可以不写, 默认显示0分.(self.params是UIViewController在ZZRouter中扩展的属性, 包含了所有参数)
self.starView.miniGrade = 0.5;//默认值, 可以不写 ,用户可以设置的最低分值.
部分思路来自其他开源库, 侵删, 联系qq:1156858877
特别鸣谢以下开源作者/开源工具
竖向瀑布流: CustomLayout
横向瀑布流: ZZCollectionViewLayout
页面路由: HHRouter
实时FPS: OttoFPSButton