{"id":15293548,"url":"https://github.com/mancongios/mcpageviewcontroller","last_synced_at":"2025-04-13T13:31:19.670Z","repository":{"id":56920248,"uuid":"101029650","full_name":"mancongiOS/MCPageViewController","owner":"mancongiOS","description":"切换滚动视图,MCPageViewController, UIPageViewController","archived":false,"fork":false,"pushed_at":"2019-10-10T03:04:12.000Z","size":7672,"stargazers_count":37,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T04:51:18.016Z","etag":null,"topics":["ios-app","swift","uipageviewcontroller"],"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/mancongiOS.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":"2017-08-22T06:35:09.000Z","updated_at":"2022-08-05T06:14:15.000Z","dependencies_parsed_at":"2022-08-20T21:50:21.084Z","dependency_job_id":null,"html_url":"https://github.com/mancongiOS/MCPageViewController","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCPageViewController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCPageViewController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCPageViewController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCPageViewController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mancongiOS","download_url":"https://codeload.github.com/mancongiOS/MCPageViewController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248721025,"owners_count":21151031,"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-app","swift","uipageviewcontroller"],"created_at":"2024-09-30T16:49:56.003Z","updated_at":"2025-04-13T13:31:14.654Z","avatar_url":"https://github.com/mancongiOS.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCPageViewController\n[![Version](https://img.shields.io/cocoapods/v/MCPageViewController.svg?style=flat)](https://cocoapods.org/pods/MCPageViewController)\n\n\n\n\n## 功能说明\n* 快速构建多页面控制器\n* 分类栏和内容视图完全解耦\n* 支持分类栏的自定义\n* 支持分类栏添加在导航栏上\n* 支持分类栏滑动悬停\n\n## 功能示例\n![示例1](https://github.com/mancongiOS/MCPageViewController/blob/master/Resources/demo1.png)\n\n![示例2](https://github.com/mancongiOS/MCPageViewController/blob/master/Resources/demo2.png)\n\n![示例3](https://github.com/mancongiOS/MCPageViewController/blob/master/Resources/demo3.png)\n\n![示例gif](https://github.com/mancongiOS/MCPageViewController/blob/master/Resources/demoGif.gif)\n\n## 如何使用?\n\n```\npod 'MCPageViewController'\n```\n\n## 代码说明\n###### 1.创建分类栏和内容栏\n```\n    /// 分类条\n    lazy var categoryBar: MCCategoryBar = {\n        let view = MCCategoryBar()\n        view.delegate = self\n        return view\n    }()\n    \n    /// 内容容器\n    lazy var containerView: MCContainerView = {\n        let view = MCContainerView()\n        view.delegate = self\n        return view\n    }()\n```\n###### 2. 配置属性\n```\n    func loadPageViewController() {\n        \n        let config = MCPageConfig()\n        \n        config.viewControllers = vcArray\n        config.categoryModels = modelArray\n        config.defaultIndex = 0\n        config.category.maxTitleCount = 10\n        \n        \n        categoryBar.initCategoryBarWithConfig(config)\n        containerView.initContainerViewWithConfig(config)\n    }\n```\n**loadPageViewController方法一定要在约束布局之前执行**\n###### 3.设置约束\n```\n    override func initUI() {\n\n        view.addSubview(categoryBar)\n        categoryBar.snp.remakeConstraints { (make) -\u003eVoid in\n            make.left.right.top.equalTo(view)\n            make.height.equalTo(40)\n        }\n        \n        view.addSubview(containerView)\n        containerView.snp.remakeConstraints { (make) -\u003eVoid in\n            make.left.right.bottom.equalTo(view)\n            make.top.equalTo(categoryBar.snp.bottom)\n        }\n    }\n\n```\n###### 4.实现分类栏和内容栏的协议\n```\nextension MCBasicUseViewController: MCCategoryBarDelegate {\n    func categoryBar(categoryBar: MCCategoryBar, didSelectItemAt index: Int) {\n        containerView.containerViewScrollToSubViewController(subIndex: index)\n    }\n}\n\nextension MCBasicUseViewController: MCContainerViewDelegate {\n    func containerView(_ containerView: MCContainerView, didScrollToIndex index: Int) {\n        categoryBar.categoryBarDidClickItem(at: index)\n    }\n}\n```\n\n\n\n---\n###### 更多的详细使用方案请下载demo示例功能。\n---\n## 联系Author\n QQ群： 316879774\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmancongios%2Fmcpageviewcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmancongios%2Fmcpageviewcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmancongios%2Fmcpageviewcontroller/lists"}