在最近的开发中经常用到时间轴组件,所以自己封装了一个高可定制的时间轴,传送门HLTimeLineView
✅1.自定义上下线颜色宽度
✅2.自定义节点颜色、实心、空心
✅3.自定义节点与线的距离
✅4.自定义节点为图片
✅5.支持xib、storyboard
✅6.支持CocoaPods导入
演示图
普通绘制节点.png图片节点.png
storyboard.jpg
使用
pod 'HLTimeLineView', '1.0.2'
可选设置属性
/// 线颜色,默认0xDCE7FF
@property (nonatomic, strong) IBInspectable UIColor *lineColor UI_APPEARANCE_SELECTOR;
/// 线宽度,默认2
@property (nonatomic, assign) IBInspectable CGFloat lineWidth UI_APPEARANCE_SELECTOR;
/// 节点背景颜色,默认whiteColor
@property (nonatomic, strong) IBInspectable UIColor *nodeBackgroundColor UI_APPEARANCE_SELECTOR;
/// 节点颜色,默认0x4181FE
@property (nonatomic, strong) IBInspectable UIColor *nodeColor UI_APPEARANCE_SELECTOR;
/// 节点边框宽度,默认2,如果nodeBorderWidth == 0那么节点就是实心圆
@property (nonatomic, assign) IBInspectable CGFloat nodeBorderWidth UI_APPEARANCE_SELECTOR;
/// 节点顶部距离,默认10
@property (nonatomic, assign) IBInspectable CGFloat nodeTop;
/// 时间轴样式,默认HLTimelineViewTypeNone
@property (nonatomic, assign) IBInspectable NSInteger type;
/// 节点顶部距离线间隙,默认0
@property (nonatomic, assign) IBInspectable CGFloat nodeTopSpace UI_APPEARANCE_SELECTOR;
/// 节点底部距离线间隙,默认0
@property (nonatomic, assign) IBInspectable CGFloat nodeBottomSpace UI_APPEARANCE_SELECTOR;
/// 节点自定义图片,默认nil
@property (nonatomic, strong) IBInspectable UIImage *nodeImage UI_APPEARANCE_SELECTOR;
如果你觉得封装的还行,帮忙小星星🌟🌟支持一下。传送门HLTimeLineView
网友评论