{"id":15050842,"url":"https://github.com/danielhusx/timeaxis","last_synced_at":"2025-08-25T06:35:18.837Z","repository":{"id":37752240,"uuid":"157145841","full_name":"DanielHusx/TimeAxis","owner":"DanielHusx","description":"录像时间轴，无限滚动","archived":false,"fork":false,"pushed_at":"2018-11-16T09:56:32.000Z","size":182,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-05T03:50:04.003Z","etag":null,"topics":["infinite-scroll","objective-c","timeaxis","timeline","video"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielHusx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-12T02:33:58.000Z","updated_at":"2024-08-25T09:57:23.000Z","dependencies_parsed_at":"2022-09-20T05:00:50.545Z","dependency_job_id":null,"html_url":"https://github.com/DanielHusx/TimeAxis","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/DanielHusx/TimeAxis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FTimeAxis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FTimeAxis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FTimeAxis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FTimeAxis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielHusx","download_url":"https://codeload.github.com/DanielHusx/TimeAxis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FTimeAxis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272013600,"owners_count":24858483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["infinite-scroll","objective-c","timeaxis","timeline","video"],"created_at":"2024-09-24T21:29:29.752Z","updated_at":"2025-08-25T06:35:18.818Z","avatar_url":"https://github.com/DanielHusx.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 录像时间轴 [TimeAxis](https://github.com/DanielHusx/TimeAxis)\n\n- 录像时间轴，无限滚动\n- 可扩展自定义绘制方法\n- 使用物理引擎UIDynamic模拟实现UIScrollView的滚动减速效果\n- 提供丰富的回调反馈，可以详细查看DHTimeAxisDelegate\n\n\n### 集成\n\n```shell\npod 'TimeAxis'\nor\n$git clone https://github.com/DanielHusx/TimeAxis.git\n```\n\n\n\n### 使用示例\n\n```objective-c\n#import \u003cDHTimeAxis.h\u003e\n\n    /**\n    DHTimeAxisAppearance是个单例类，用于控制外观属性，具体属性请查看该类\n    其中属性rendererClass 必须是继承DHTimeAxisRenderer的子类，\n    它是能够使用DHTimeAxisAppearance属性进行绘制的类，具体使用方式可以参照DHTimeAxisGearRenderer或DHTimeAxisRuleRenderer的实现\n    */\n    [DHTimeAxisAppearance renderGearAppearanceWithDirection:DHAxisDirectionHorizontal];\n\n    DHTimeAxis *axis = [[DHTimeAxis alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height/2.0-100, self.view.frame.size.width, 100)];\n    axis.delegate = self\n    [self.view addSubview:axis];\n\n```\n\n### 丰富的回调\n```objective-c\n@class DHTimeAxis;\n@protocol DHTimeAxisDelegate \u003cNSObject\u003e\n@optional\n/// 更新当前时间\n- (void)timeAxis:(DHTimeAxis *)timeAxis didChangedTimeInterval:(NSTimeInterval)currentTimeInterval;\n/// 更新放缩比例\n- (void)timeAxis:(DHTimeAxis *)timeAxis didChangedScale:(CGFloat)currentScale;\n/// 停止的位置存在数据\n- (void)timeAxis:(DHTimeAxis *)timeAxis didEndedAtDataSection:(DHTimeAxisData *)aAxisData;\n/// 开始滚动\n- (void)timeAxisDidBeginScrolling:(DHTimeAxis *)timeAxis;\n/// 结束滚动\n- (void)timeAxisDidEndScrolling:(DHTimeAxis *)timeAxis;\n/// 开始捏合手势\n- (void)timeAxisDidBeginPinching:(DHTimeAxis *)timeAxis;\n/// 结束捏合手势\n- (void)timeAxisDidEndPinching:(DHTimeAxis *)timeAxis;\n/**\n 外部提供偏移当前时间参数 的计算方法\n @param offset 手势造成的偏移\n @param viewSize 视图长宽\n @param opOffset 计算后的偏移值\n @param opViewSize 计算后的尺寸\n */\n- (void)translationCurrentTimeIntervalFromOffset:(CGPoint)offset viewSize:(CGSize)viewSize toOptimisticOffset:(CGFloat *)opOffset optimisticViewSize:(CGFloat *)opViewSize;\n@end\n```\n\n### 绘制方法：\n自定义绘制方法只需要两步：\n1. 继承DHTimeAxisRenderer类并实现如下方法，具体实现内容可以参考DHTimeAxisGearRenderer类和DHTimeAxisRuleRenderer类\n```objective-c\n/// 绘制数据\n- (void)visitTimeAxisData:(DHTimeAxisData *)aTimeAxisData;\n/// 绘制刻度线\n- (void)visitTimeAxisRule:(DHTimeAxisRule *)aTimeAxisRule;\n/// 绘制基线\n- (void)visitTimeAxisBaseLine:(DHTimeAxisBaseLine *)aTimeAxisBaseLine;\n/// 绘制数字与分割线\n- (void)visitTimeAxisDigitalDivision:(DHTimeAxisDigitalDivision *)aTimeAxisDigitalDivision;\n/// 绘制背景\n- (void)visitTimeAxisBackground:(DHTimeAxisBackground *)aTimeAxisBackground;\n\n\n// 另外需要根据对应数据更新的话，可继承如下方法，务必调用super\n- (void)updateValueWithTimeAxisRule:(DHTimeAxisRule *)aTimeAxisRule;\n- (void)updateValueWithTimeAxisBaseLine:(DHTimeAxisBaseLine *)aTimeAxisBaseLine;\n- (void)updateValueWithTimeAxisDigitalDivision:(DHTimeAxisDigitalDivision *)aTimeAxisDigitalDivision;\n- (void)updateValueWithTimeAxisBackground:(DHTimeAxisBackground *)aTimeAxisBackground;\n```\n2. 设置`[DHTimeAxisAppearance sharedAppearance].rendererClass`为自定义类名并更新方法\n\n```objective-c\n[DHTimeAxisAppearance sharedAppearance].rendererClass = [DHTimeAxisGearRenderer class];\n[[DHTimeAxisAppearance sharedAppearance] updateAppearance];\n```\n\n\n\n### 效果图\n\n#### DHTimeAxisGearRenderer\n\n![GearExample.png](./ReadMeAssets/GearExample.png)\n\n#### DHTimeAxisRuleRenderer\n\n![RuleRenderer](./ReadMeAssets/RuleExample.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhusx%2Ftimeaxis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielhusx%2Ftimeaxis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhusx%2Ftimeaxis/lists"}