Git Product home page Git Product logo

dmpagerviewcontroller's Introduction

DMPagerViewController

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

DMPagerViewController is a UIViewController subclass which mimics the navigation system used in Twitter and Tinder clients for iOS. It also add some special effects like icon tint color fade on scroll and page parallax effect during scroll. It also offer several configuration options you can easily see in .h file. Because an image worth more than thousand of words this is a short gif which show you the class.

A short introduction

To run the example project, clone the repo, and run pod install from your project.

Then you can create a new DMPagerViewController which contains your child view controllers like this:

UIViewController * vc1 = ...;
UIViewController * vc2 = ...;
UIViewController * vc3 = ...;
self.pagerController = [[DMPagerViewController alloc] initWithViewControllers: @[vc1,vc2,vc3]];

Your child view controllers must be conform to DMPagerViewControllerProtocol protocol in order to return the appropriate item to show into the navigation bar (used only when .useNavigationBar is set to YES).

So each view controller must implement:

- (DMPagerNavigationBarItem *)pagerItem {
	 DMPagerNavigationBarItem *item;
	 UIImage *itemIcon = ...;
	 NSAttributedString *itemTitle = ...;
	 item = [DMPagerNavigationBarItem newItemWithText:itemTitle andIcon: itemIcon];
	item.renderingMode = DMPagerNavigationBarItemModeOnlyText;
	return item;
}

Using .renderingMode you can decide what show for a specified item (the icon, icon and text or only the text).

You can choose between three different transitions to use when moving programmatically between pages using -setPageIndex:animated::

typedef NS_ENUM(NSInteger, DMPagerViewControllerAnimation) {
	// Standard UIScrollView animation
	DMPagerViewControllerAnimationStandard,
	// Ease In+Out animation on scroll
	DMPagerViewControllerAnimationEaseInOut,
	// Animation with final bounce
	DMPagerViewControllerAnimationBounceEnd,
	// Animation with initial+final bounce
	DMPagerViewControllerAnimationBounceStartEnd
};

Navigation Bar can also be customized (it's an UIView): you can decide what kind of transition (in term of colors) you want to use for navigation bar items: take a look at .colorizeMode (DMPagerNavigationBarItemColorize). Also you can decide the layout of the navigation bar itself via .style property (DMPagerNavigationBarStyle)

You can push it from a navigation stack or put it into the root window. You can also access to navigationBar configuration via .navigationBar property.

Requirements

It works fine with iOS 8. Should work in iOS7 but I've not tested it.

Installation

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

pod "DMPagerViewController"

Author

Daniele Margutti Mail: [email protected] Web: danielemargutti.com

License

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

dmpagerviewcontroller's People

Contributors

malcommac avatar pettersamuelsen avatar

Watchers

 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.