NoiseView.h 4.4 KB
//
//  NoiseView.h
//  DreamSleep
//
//  Created by peter on 2022/5/12.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/**
 下划线长度取值类型
 
 - LineWidthTypeStaticShort: 静态短长度,取个固定短值
 - LineWidthTypeStaticLong: 静态长度,根据总长度/数量
 - LineWidthTypeDynamic: 动态长度,根据文字长度
 */
typedef NS_ENUM(NSInteger, LineWidthType) {
    LineWidthTypeStaticShort = 0,
    LineWidthTypeStaticLong,
    LineWidthTypeDynamic
};

/**
 分页条目 cell 宽度取值类型
 
 - PageCellWidthTypeWithTitleLength: 根据 cell 标题文字长度取值
 - PageCellWidthTypeSplitScreen: pageCell个数小于屏宽最大cell展示个数时,按个数平分屏宽
 - PageCellWidthTypeWidthByStaticCount: 根据屏宽最大cell展示个数平分屏宽
 */
typedef NS_ENUM(NSInteger, PageCellWidthType) {
    PageCellWidthTypeByTitleLength = 0,
    PageCellWidthTypeSplitScreen,
    PageCellWidthTypeWidthByStaticCount
};

/**
 下划线在条目切换时的动态表现类型

 - LineScrollTypeDynamicAnimation: 滑动即时的下划线动态动画
 - LineScrollTypeDynamicLinear: 滑动即时的下划线线性动画
 - LineScrollTypeFinishedLinear: 滑动完成后的下划线线性动画
 */
typedef NS_ENUM(NSInteger, LineScrollType) {
    LineScrollTypeDynamicAnimation = 0,
    LineScrollTypeDynamicLinear,
    LineScrollTypeScrollEndLinear
};

/** 分页滑动时标题字体大小改变方式
 
 - PageTitleFontChangeTypeScrolling: 滑动中实时改变
 - PageTitleFontChangeTypeScrollEnd: 滑动结束无动画改变
 - PageTitleFontChangeTypeScrollEndAnimation: 滑动结束动画改变
 */
typedef NS_ENUM(NSInteger, PageTitleFontChangeType) {
    PageTitleFontChangeTypeScrolling = 0,
    PageTitleFontChangeTypeScrollEnd,
    PageTitleFontChangeTypeScrollEndAnimation
};

/** 分页滑动时标题颜色改变方式
 
 - PageTitleColorChangeTypeScrolling: 滑动中实时改变
 - PageTitleColorChangeTypeScrollEnd: 滑动结束改变
 */
typedef NS_ENUM(NSInteger, PageTitleColorChangeType) {
    PageTitleColorChangeTypeScrolling = 0,
    PageTitleColorChangeTypeScrollEnd
};

/// 首页白噪音自定义view
@interface NoiseView : UIView

/// 配置分页类型数据
/// @param data data
- (void)refreshNoiseTypeData:(NSArray *)data;

/// 初始化
/// @param data data
- (instancetype)initWithNoiseTypeData:(NSArray *)data;

/** 分页条高度 */
@property(nonatomic, assign) CGFloat pageBarHeight;
/** 分页条背景色 */
@property (nonatomic,strong) UIColor *pageBarBgColor;
/** 下滑线颜色 */
@property (nonatomic,strong) UIColor *lineColor;
/** 下滑线颜色数组 */
@property (nonatomic,strong) NSArray *lineColors;
/** 下滑线高度 */
@property (nonatomic,assign) CGFloat lineHeight;
/** 下划线固定宽度: lineWidthType=LineWidthTypeStaticShort时设置,其他类型自动计算 */
@property (nonatomic,assign) CGFloat lineStaticWidth;
/** 分页工具条在展示区域的条目数量展示最大值: 在导航条上时默认值4,在一屏宽度上时默认值5 */
@property (nonatomic,assign) NSInteger maxPagesCountInPageShowArea;
/** 下划线长度取值类型 */
@property (nonatomic,assign) LineWidthType lineWidthType;
/** 下划线在条目切换时的动态表现类型 */
@property (nonatomic,assign) LineScrollType lineScrollType;
/** 分页条目 cell 宽度取值类型 */
@property (nonatomic,assign) PageCellWidthType pageCellWidthType;
/** 分页滑动时标题字体大小改变方式 */
@property (nonatomic,assign) PageTitleFontChangeType pageTitleFontChangeType;
/** 分页滑动时标题颜色改变方式 */
@property (nonatomic,assign) PageTitleColorChangeType pageTitleColorChangeType;
/** 标题颜色 */
@property (nonatomic,strong) UIColor *titleColor;
/** 标题选中颜色(可不设置) */
@property (nonatomic,strong) UIColor *titleSelectedColor;
/** 标题字体, default: [UIFont systemFontOfSize:15] */
@property (nonatomic,strong) UIFont *titleFont;
/** 标题选中字体(可不设置), default: [UIFont systemFontOfSize:20] */
@property (nonatomic,strong) UIFont *titleSelectedFont;

/** 默认选择的 index 位置 ,默认值为0*/
@property (nonatomic,assign) NSInteger defaultIndex;

/** 分页控制器View视图的 Y 轴方向 设置初始位置(适用于分页条不在导航条上的情况) , 动态位置由于UICollectionViewCell 的复用存在不可知 bug, 暂不实现*/
@property (nonatomic, assign) CGFloat originY;
@end

NS_ASSUME_NONNULL_END