ADPaginator 0.1.1

ADPaginator 0.1.1

Stefan Adams 维护。



  • AdamsDevelopment

Paginator

Version License Platform

示例

要运行示例项目,请克隆仓库,然后从 Example 目录先运行 pod install

===============================================================================

分页视图控制器中实现的控制器需要遵守 Pageable 协议。

class ViewControllerOne: UIViewController, Pageable {

    // MARK: - Paging implicit properties

    var pageTitle: String {
        return "vcOne"
    }

    func pagingViewDidShow() {
        textfield.becomeFirstResponder()
    }
}

要在您的基视图控制器中实现它

    /// This function is used to only at the pagingView (top bar),
    /// with an amount of titles given to it.
    func exampleAddingOnlyThePagingView() {
        // PagingView titles
        let pagingView = PagingView(titles: ["Red", "Gray", "Blue"])

        // PagingView Delegate
        pagingView.delegate = self

        // Add pagingView
        pagingView.translatesAutoresizingMaskIntoConstraints = false
        view.addSubview(pagingView)

        // give the pagingView some contstraints
        pagingView.topAnchor.constraint(equalTo: view.topAnchor, constant: 16).isActive = true
        pagingView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
        pagingView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
        pagingView.heightAnchor.constraint(equalToConstant: 100).isActive = true
    }

    /// Here we instantiate some viewControllers, and show the pagingViewController with the initialized viewControllers.
    /// We can add this PagingViewController to a containerView so we have a baseController that is in control of the pagingViewController.
    func exampleAddingThePagingViewController() {
        let controller1 = ViewControllerOne()
        let controller2 = ViewControllerTwo()
        let controller3 = ViewControllerThree()

        let controller = PagingViewController(viewControllers: [controller1, controller2, controller3], initialIndex: 0)
        self.present(controller, animated: true, completion: nil)
    }

安装

Paginator 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 即可

pod 'ADPaginator'

贡献力量

对于那些想要贡献力量的人来说,请创建 develop 分支上的功能分支,完成后创建一个 Pull Request。我们将与 'Master' 分支的发布版本和 'Beta' 分支的测试版本一起工作。

作者

AdamsDevelopment, [email protected]

许可证

分页器可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。