{"id":15038664,"url":"https://github.com/elenionl/eltabscrollcontroller","last_synced_at":"2025-08-01T09:15:16.735Z","repository":{"id":56909408,"uuid":"89083154","full_name":"Elenionl/ELTabScrollController","owner":"Elenionl","description":"Easily Used Tab Scroll ViewController build with Swift 3","archived":false,"fork":false,"pushed_at":"2018-11-16T05:09:45.000Z","size":2778,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T15:51:38.394Z","etag":null,"topics":["swift","swift3","switch","tab-scroll-viewcontroller","tabcontroller","tabs"],"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/Elenionl.png","metadata":{"files":{"readme":"README IN CHINESE.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-22T16:22:08.000Z","updated_at":"2018-11-16T05:09:05.000Z","dependencies_parsed_at":"2022-08-20T19:50:34.449Z","dependency_job_id":null,"html_url":"https://github.com/Elenionl/ELTabScrollController","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elenionl%2FELTabScrollController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elenionl%2FELTabScrollController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elenionl%2FELTabScrollController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elenionl%2FELTabScrollController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Elenionl","download_url":"https://codeload.github.com/Elenionl/ELTabScrollController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239084401,"owners_count":19578773,"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":["swift","swift3","switch","tab-scroll-viewcontroller","tabcontroller","tabs"],"created_at":"2024-09-24T20:39:34.510Z","updated_at":"2025-02-16T03:31:28.906Z","avatar_url":"https://github.com/Elenionl.png","language":"Swift","readme":"ELTabScrollChontroller: 简单易用的 Tab Scroll Controller, 使用 Swift 3 开发\n======================================\n\n[![Build Status](https://travis-ci.org/Elenionl/ELTabScrollController.svg?branch=master)](https://travis-ci.org/Elenionl/ELTabScrollController)\n[![Apps Using](https://img.shields.io/cocoapods/at/ELTabScrollController.svg?label=Apps%20Using%20ELTabScrollController\u0026colorB=28B9FE)](http://cocoapods.org/pods/ELTabScrollController)\n[![Downloads](https://img.shields.io/cocoapods/dt/ELTabScrollController.svg?label=Total%20Downloads\u0026colorB=28B9FE)](http://cocoapods.org/pods/ELTabScrollController)\n[![CocoaPods](https://img.shields.io/cocoapods/v/ELPickerView.svg?style=flat)](https://cocoapods.org/pods/ELPickerView)\n[![CocoaPods](https://img.shields.io/cocoapods/l/ELPickerView.svg?style=flat)](https://cocoapods.org/pods/ELPickerView)\n[![Platform](https://img.shields.io/cocoapods/p/ELPickerView.svg?style=flat)](https://cocoapods.org/pods/ELPickerView)\n\n**:warning: ELTabScrollChontroller 适用于 Swift 3.X 和 iOS 9.X\n\n## 截图\n 简单易用的 Tab Scroll Controller, 使用 Swift 3 开发\n\n\n![screenshots_1](https://raw.githubusercontent.com/Elenionl/ELTabScrollController/master/screenshots/2017-04-23%2000.40.02.gif)\n-----------\n\n## 安装方法\n\n### 使用 [CocoaPods](https://cocoapods.org/pods/ELTabScrollController)\n-----------\n* 在 ``podfile`` 中添加下面一行代码 :\n``pod 'ELTabScrollChontroller'``\n* Swift 3.* 对应 3.0.0 版本的 pod\n* Swift 4.* 对应 4.* 版本的 pod\n* 使用 Terminal 运行 `pod install`\n* 完成!\n-----------\n### 直接添加\n* 用浏览器打开 [Elenionl/ELTabScrollChontroller](https://github.com/Elenionl/ELTabScrollController)\n* 下载或克隆项目: ``https://github.com/Elenionl/ELTabScrollController.git``\n* 复制项目中的 ``ELTabScrollChontroller.swift`` 与 ``UIKit+EL.swift``文件到您的项目中\n* 完成!\n\n------------\n## 如何使用\n\n### 如果您想在您的 App 中使用 ELTabScrollController, 只需要简单的两步:\n* 创建\n```Swift\nclass TabScrollController: ELTabScrollController {\n    // MARK: - LifeCircle\n    init() {\n        super.init()\n    }\n```\n或者在创建时指定类型\n```Swift\nclass TabScrollController: ELTabScrollController {\n    // MARK: - LifeCircle\n    init() {\n        super.init(width: 200, type: .equal_scrollable)\n    }\n```\n* 添加要显示的内容\n```Swift\noverride func viewDidLoad() {\n  super.viewDidLoad()\n  let ctrl1 = ViewController(nibName: nil, bundle: nil)\n  let ctrl2 = ViewController(nibName: nil, bundle: nil)\n  let ctrl3 = ViewController(nibName: nil, bundle: nil)\n  let ctrl4 = ViewController(nibName: nil, bundle: nil)\n  let item1 = ELTabScrollItem(title: \"Tab 1\", image: nil, viewController: ctrl1, view: nil)\n  let item2 = ELTabScrollItem(title: \"Tab 2\", image: nil, viewController: ctrl2, view: nil)\n  let item3 = ELTabScrollItem(title: \"Tab 3\", image: nil, viewController: ctrl3, view: nil)\n  let item4 = ELTabScrollItem(title: \"Tab 4\", image: nil, viewController: ctrl4, view: nil)\n  items = [item1, item2, item3, item4]\n}\n```\n----------------------\n### ELTabScrollController 的类型\nELTabScrollController 共有四种类型\n* equal_unscrollable\n* equal_scrollable\n* unequal_unscrollable\n* unequal_scrollable\n\n**equal** 所有按钮宽度相等\n\n**unequal** 按钮宽度由其本身的 contentSize 决定\n\n**unscrollable** tab 不可滚动且宽度等于 ELTabScrollController.width\n\n**scrollable** tab 可以滚动, 宽度可能大于 ELTabScrollController.width\n\n\n----------------------\n### 如果你想要只显示 ChildViewController 的某一个 view, 只需要如下操作\n\n```Swift\n    let ctrl1 = ViewController(nibName: nil, bundle: nil)\n    let item1 = ELTabScrollItem(title: \"Tab 1\", image: nil, viewController: ctrl1, view: ctrl1.tableView)\n```\n--------------\n### 滑动分页或点击按钮会产生回调\n\n* 设置回调\n```Swift\nself.switchHandler = { (index, type) in\n    print(index, type)\n}\n```\n* 打印内容如下\n```Swift\n2 buttonTap\n2 buttonTap\n3 buttonTap\n1 buttonTap\n1 buttonTap\n0 scroll\n0 scroll\n1 scroll\n```\n--------------------------\n### 按钮可以定制\n***:warning: 对于 button 订制优先级低于对 tabScrollController 的设置, 例如 ELTabScrollController.buttonSelectedBackgroudColor 属性会覆盖掉 ELTabScrollItem.button 的设置.***\n* 设置按钮的标题和图片\n```Swift\nlet item4 = ELTabScrollItem(title: \"Tab 4\", image: UIImage(named: \"image\"), viewController: ctrl4, view: nil)\n```\n* 完全自定义按钮\n```Swift\npublic init(button: UIButton, viewController: UIViewController, view: UIView?)\n```\n--------------------\n### ELTabScrollController 也可以自定义\n```Swift\noverride func viewDidLoad() {\n  super.viewDidLoad()\n  self.title = \"Demo\"\n  tab.backgroundColor = UIColor.orange\n  sliderView.backgroundColor = .white\n  container.backgroundColor = UIColor.lightGray\n  tabButtonHeight = 66\n  sliderViewHeight = 10\n  buttonFont = UIFont.boldSystemFont(ofSize: 18)\n  buttonSelectedTitleColor = UIColor.white\n  buttonNormalTitleColor = UIColor.lightGray\n  switchHandler = { (index, type) in\n    print(index, type)\n  }\n}\n```\n-----------------\n## 可用的设置\n\n```Swift\n// MARK: - Settings\n\n/// Items containing buttons and viewControllers\n\nopen var tabBarType: ELTabBarType = ELTabBarType.equal_unscrollable\n\n/// Distance between buttons. Default value: 30.0 for scrollable, 0 for unscrollable.\nopen var tabSpacing: CGFloat\n\n/// The zoom factor for buttons, only available in scrollable tabs. Default value: 1.05\nopen var buttonHorizontalZoomFactor: CGFloat = 1.05\n\n/// Items containing buttons and viewControllers\nopen var items: [ELTabScrollItem]! = []\n\n/// The width of the base view. Default value is screen width\nopen var width: CGFloat! = UIScreen.main.bounds.size.width\n\n/// Triggered by switch behavior\nopen var switchHandler: ELSwitchHandler?\n\n/// Height of button\nopen var tabButtonHeight: CGFloat = 44\n\n/// Hight of slider\nopen var sliderViewHeight: CGFloat = 5\n\n/// Font of button\nopen var buttonFont: UIFont?\n\nopen var buttonSelectedBackgroudColor: UIColor?\n\nopen var buttonNormalBackgroudColor: UIColor?\n\nopen var buttonSelectedTitleColor: UIColor?\n\nopen var buttonNormalTitleColor: UIColor?\n\n```\n------------\n## 要求\n\n* Xcode 8.X\n* Swift 3.X\n* Using ARC\n* iOS 9.0\n--------------\n\n## TODO\n\n* ✅ More Tab Style\n* ❎ More Slider Style\n\n## 作者\n\nHanping Xu ([Elenionl](https://github.com/Elenionl)), stellanxu@gmail.com\n\n\n--------------------------\n## License\n\nELTabScrollController is available under the MIT license, see the LICENSE file for more information.   \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felenionl%2Feltabscrollcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felenionl%2Feltabscrollcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felenionl%2Feltabscrollcontroller/lists"}