Latest 0.1.0
Homepage https://github.com/Handii-inc/HDTabbedPageView
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Description

Inspired by TabPageViewController.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

You can use it with inheritance of HDTabbedPageViewController and implementation of HDTabbedPageViewControllerimplementation and HDTabbedPageViewControllerStyle.

It’s very easy as the following.

class ViewController: HDTabbedPageViewController, HDTabbedPageViewControllerDataSource, HDTabbedPageViewControllerStyle {
    //MARK:- Sub components.
    private let roundedRect = RoundedRect(color: .orange, padding: 5)

    //MARK:- Life cycle events.
    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = .white

        self.dataSource = self
        self.style = self
        self.indicator = self.roundedRect
    }

    override func viewWillLayoutSubviews() {
        super.viewWillLayoutSubviews()
        self.view.frame = UIScreen.main.bounds
    }

    //MARK:- HDTabbedPageViewControllerDataSource
    var controllers: [UIViewController] = [
        ViewController.createSampleViewController("Red", .red),
        ViewController.createSampleViewController("Cyan", .cyan),
        ViewController.createSampleViewController("Green", .green),
    ]

    //MARK:- HDTabbedPageViewControllerStyle
    var textColorOfTab: UIColor {
        get {
            return .black
        }
    }

    //MARK:- Helper
    private static func createSampleViewController(_ title: String,
                                                   _ color: UIColor) -> UIViewController
    {
        let controller = UIViewController()
        controller.title = title
        controller.view.backgroundColor = color
        return controller
    }
}

Customize

You can easy to customize this library.

HDTabbedPageViewControllerDataSource

There are two optional interfaces except controllers.

  • count : The number of data source. It is the default implementation to return controllers.count.
  • titles : The titles of controllers. It is the default implementation to return titles of controllers.

HDTabbedPageViewControllerStyle

There are optional interfaces except textColorOfTab.

  • textSizeOfTab : The color of tab of text.
  • heightOfTab : The height of tab.(default 45)
  • topGapOfTab : The gap of the top of tab.(default 0)
  • bottomGapOfTab : The gap of the bottom of tab.(default 0)

HDTabbedPageViewIndicator

This is the protocol for indicator.
When you create implementation of this protocol, you should create as subclass of UIView.

There are two reference implementation, please refer them if you want to implement your customize one.
Those are Underline and RoundedRect.

Installation

HDTabbedPageView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'HDTabbedPageView'

Author

Handii, Inc. [email protected]

License

HDTabbedPageView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "HDTabbedPageView",
    "version": "0.1.0",
    "summary": "Tabbed page view controller.",
    "description": "Tabbed page view controller with easy to use.",
    "homepage": "https://github.com/Handii-inc/HDTabbedPageView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Handii, Inc.": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Handii-inc/HDTabbedPageView.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "HDTabbedPageView/Classes/**/*",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This