Git Product home page Git Product logo

lxpageviewwithbuttonsviewcontroller's Introduction

LXPageViewWithButtonsViewController

[![CI Status](http://img.shields.io/travis/Shell Xian/LXPageViewWithButtonsViewController.svg?style=flat)](https://travis-ci.org/Shell Xian/LXPageViewWithButtonsViewController) Version License Platform

LXPageViewWithButtonsViewController wraps the UIPageViewController and provides a scrollabel page selections buttons. It aims to provide a highly customizable UI component.

It's inspired by RKSwipeBetweenViewControllers. While RKSwipeBetweenViewControllers fixes the buttons in the navigation bar, LXPageViewWithButtonsViewController allows you to put the selections buttons anywhere you like.

Usage

Add view controllers.

Button labels will be set to the corresponding view controller's title

import LXPageViewWithButtonsViewController // import is needed if it is installed by CocoaPods
...
let pwbVC = LXPageViewWithButtonsViewController()
pwbVC.viewControllers = [someViewController0, someViewController1, someViewController2]

Customize the appreance

Appreance customization is grouped under LXButtonsScrollView.appearance property

/// set appreance globally
LXButtonsScrollView.appearance.button.foregroundColor.normal = UIColor.Presets.TapLightGray.color
LXButtonsScrollView.appearance.button.foregroundColor.selected = UIColor.Presets.TextBlack.color
LXButtonsScrollView.appearance.selectionIndicator.color = UIColor.Presets.TextBlack.color

/// set appearance for a particular view controller
let pwbVC = LXPageViewWithButtonsViewController()
pwbVC.buttonsScrollView.appearance.button.width = 70
pwbVC.buttonsScrollView.appearance.button.height = 40

List of supported customizations could be found in LXButtonsScrollViewAppearance.swift

  appearance.button.font.normal
  appearance.button.font.selected
  appearance.button.foregroundColor.normal
  appearance.button.foregroundColor.selected
  appearance.button.backgroundColor.normal
  appearance.button.backgroundColor.selected
  appearance.button.width
  appearance.button.height
  appearance.button.margin
  appearance.button.gap
  appearance.selectionIndicator.color
  appearance.selectionIndicator.height

For further customizations, buttons are accessable via LXButtonsScrollViewAppearance.buttonsScrollView.buttons.

The position of the selection buttons

By default, the selection buttons are positioned at the top of the page view controller. You can change the layout by override LXPageViewWithButtonsViewController.lx_LayoutViews

override func lx_LayoutViews() {
  /// do layout you want here
  /// the container view for selection buttons can be accessed by self.buttonsScrollView
  /// the view for the page view controller is self.pageViewController.view
}

Installation

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

use_frameworks!
pod "LXPageViewWithButtonsViewController"

or

use_frameworks!
pod 'LXPageViewWithButtonsViewController', :git=> 'https://github.com/lxian/LXPageViewWithButtonsViewController.git'

Author

Li Xian, [email protected]

License

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

lxpageviewwithbuttonsviewcontroller's People

Contributors

lxian avatar

Stargazers

anseee avatar MohsinAli avatar

Watchers

MohsinAli avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.