{"id":22599886,"url":"https://github.com/glthello/ltautoscrollview","last_synced_at":"2025-04-11T01:35:33.255Z","repository":{"id":56919186,"uuid":"127884053","full_name":"glthello/LTAutoScrollView","owner":"glthello","description":"自定义CollectionView轮播图，不依赖任何图片加载框架，可实现自定义pageControl，自定义轮播View，自定义滚动样式等等","archived":false,"fork":false,"pushed_at":"2018-09-07T09:38:54.000Z","size":6981,"stargazers_count":58,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T22:42:19.538Z","etag":null,"topics":["ios","scrollview","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/glthello.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-04-03T09:27:12.000Z","updated_at":"2024-10-25T13:59:40.000Z","dependencies_parsed_at":"2022-08-21T04:20:15.108Z","dependency_job_id":null,"html_url":"https://github.com/glthello/LTAutoScrollView","commit_stats":null,"previous_names":["glthello/ltautoscrollview","gltwy/ltautoscrollview"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glthello%2FLTAutoScrollView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glthello%2FLTAutoScrollView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glthello%2FLTAutoScrollView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glthello%2FLTAutoScrollView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glthello","download_url":"https://codeload.github.com/glthello/LTAutoScrollView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248325771,"owners_count":21084974,"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","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":["ios","scrollview","swift"],"created_at":"2024-12-08T11:12:30.366Z","updated_at":"2025-04-11T01:35:33.237Z","avatar_url":"https://github.com/glthello.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LTAutoScrollView\n\n[![CI Status](http://img.shields.io/travis/1282990794@qq.com/LTAutoScrollView.svg?style=flat)](https://travis-ci.org/1282990794@qq.com/LTAutoScrollView)\n[![Version](https://img.shields.io/cocoapods/v/LTAutoScrollView.svg?style=flat)](http://cocoapods.org/pods/LTAutoScrollView)\n[![License](https://img.shields.io/cocoapods/l/LTAutoScrollView.svg?style=flat)](http://cocoapods.org/pods/LTAutoScrollView)\n[![Platform](https://img.shields.io/cocoapods/p/LTAutoScrollView.svg?style=flat)](http://cocoapods.org/pods/LTAutoScrollView)\n\n![image](https://github.com/gltwy/LTAutoScrollView/blob/master/gltauto.gif)\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Installation with CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Swift, which automates and simplifies the process of using 3rd-party libraries like LTAutoScrollView in your projects.  You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n#### Podfile\n\nTo integrate LTAutoScrollView into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\n\ntarget 'TargetName' do\npod 'LTAutoScrollView'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n## Usage\n\n#### 创建LTAutoScrollView\n\n```swift\nlet autoScrollView = LTAutoScrollView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: 150))\n\n//设置滚动时间间隔 默认2.0s\nautoScrollView.glt_timeInterval = 1.5\n        \n//设置轮播图的方向 默认水平\nautoScrollView.scrollDirection = .vertical\n\n//加载网络图片传入图片url数组， 加载本地图片传入图片名称数组\nautoScrollView.images = images\n\n//加载图片，内部不依赖任何图片加载框架\nautoScrollView.imageHandle = {(imageView, imageName) in\n    //加载本地图片（根据传入的images数组来决定加载方式）\n    imageView.image = UIImage(named: imageName)\n    //加载网络图片（根据传入的images数组来决定加载方式）\n    //imageView.kf.setImage(with: URL(string: imageName))\n}\n\n// 滚动手势禁用（文字轮播较实用） 默认为false\nautoScrollView.isDisableScrollGesture = false\n\n//设置pageControl View的高度 默认为20\nautoScrollView.gltPageControlHeight = 20;\n\n// 是否自动轮播 默认true\nautoScrollView.isAutoScroll = true\n\n//dot在轮播图的位置 中心 左侧 右侧 默认居中\nautoScrollView.dotDirection = .default\n\n//点击事件\nautoScrollView.didSelectItemHandle = {\n    print(\"autoScrollView1 点击了第 \\($0) 个索引\")\n}\n\n//自动滚动到当前索引事件\nautoScrollView.autoDidSelectItemHandle = { index in\n    print(\"autoScrollView1 自动滚动到了第 \\(index) 个索引\")\n}\n\n//PageControl点击事件\nautoScrollView.pageControlDidSelectIndexHandle = { index in\n    print(\"autoScrollView1 pageControl点击了第 \\(index) 个索引\")\n}\n\n//设置pageControl的位置\nautoScrollView.dotDirection = .right\n//dot在轮播图的位置 左侧 或 右侧时，距离最屏幕最左边或最最右边的距离，默认0\nautoScrollView.adjustValue = 15.0\n//pageControl高度调整从而改变pageControl位置 默认20\nautoScrollView.gltPageControlHeight = 25\n\n//设置LTDotLayout，更多dot使用见LTDotLayout属性说明\nlet layout = LTDotLayout(dotImage: dotImage, dotSelectImage: dotSelectImage)\nlayout.dotMargin = 10.0\nautoScrollView.dotLayout = layout\n```\n\n#### LTDotLayout属性说明\n\n```swift\n/* dot单独的一个的宽度 */\npublic var dotWidth: CGFloat = isPostDotSize\n/* dot单独的一个的高度 */\npublic var dotHeight: CGFloat = isPostDotSize\n/* dot之间的间距 */\npublic var dotMargin: CGFloat = 15.0\n/* dot未选中的图片 */\npublic var dotImage: UIImage?\n/* dot选中后的图片 */\npublic var dotSelectImage: UIImage?\n/* dot未选中的颜色 */\npublic var dotColor: UIColor = UIColor.clear\n/* dot选中的后颜色 */\npublic var dotSelectColor: UIColor = UIColor.clear\n/* custom为默认是自定义 ， 想使用类似系统样式传入default */\npublic var dotType: LTAutoScrollViewType = .custom\n/* 滚动过程是否放大当前dot */\npublic var isScale: Bool = true\n/* 滚动过程dot放大倍率 */\npublic var scaleXY: CGFloat = 1.4\n```\n\n## Author\n\n1282990794@qq.com\n\n## License\n\nLTAutoScrollView is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglthello%2Fltautoscrollview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglthello%2Fltautoscrollview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglthello%2Fltautoscrollview/lists"}