Giter VIP home page Giter VIP logo

scpageviewcontroller's Introduction

SCPageViewController

SCPageViewController is a container view controller which allows you to paginate other view controllers and build custom transitions between them while providing correct physics and appearance calls.

It was build with the following points in mind:

  1. Vertical or horizontal navigation
  2. Customizable transitions and animations (through layouters and easing functions)
  3. Pagination
  4. Realistic physics
  5. Correct appearance calls
  6. Customizable interaction area
  7. Completion blocks and more..

Change Log v1.1.0

  • Switched to SCScrollView

  • Drops CAMediaTimingFunction in favour of AHEasing for more animation options and control (31 easing functions available ootb with support for creating custom ones through the SCEasingFunctionProtocol)

  • Fixes display link retain cycles

  • Allows content offset animation interruption

  • Various other tweaks and fixes

  • New easing functions examples

    • Ease In Out Back Plain+BackEaseInOut

    • Ease Out Bounce Plain+BounceEaseOut

    • Ease Out Elastic Plain+ElasticEaseOut

Screenshots

Parallax+Sliding+Plain

Implementation details

SCPageViewController is build on top of an UIScrollView which gives us the physics we need, content insets for all the 4 positions, callbacks for linking the custom transitions to and easy to build pagination. By overriding the scrollView's shouldReceiveTouch: method we also get the customizable interaction area.

The controller stack relies on layouters to know where to place each of the controllers at every point. They are build on top of a simple protocol and the demo project contains 4 examples with various effects.

Usage

  • Import the controller into your project
#import "SCPageViewController.h"
  • Create a new instance and set its data source and delegate
	self.pageViewController = [[SCPageViewController alloc] init];
    [self.pageViewController setDataSource:self];
    [self.pageViewController setDelegate:self];
  • Set a layouter
	[self.pageViewController setLayouter:[[SCPageLayouter alloc] init] animated:NO completion:nil];
  • Set other optional properties
	[self.pageViewController setPagingEnabled:NO];

    [self.pageViewController setContinuousNavigationEnabled:YES];

    [self.pageViewController setDecelerationRate:UIScrollViewDecelerationRateNormal];

    [self.pageViewController setBounces:NO];

    [self.pageViewController setMinimumNumberOfTouches:2];
    [self.pageViewController setMaximumNumberOfTouches:1];

    [self.pageViewController setTouchRefusalArea:[UIBezierPath bezierPathWithRect:CGRectInset(self.view.bounds, 50, 50)]];
    
    [self.pageViewController setEasingFunction:[SCEasingFunction easingFunctionWithType:SCEasingFunctionTypeLinear]];
    [self.pageViewController setAnimationDuration:1.0f];
  • And, finally, implement the SCPageViewControllerDataSource
- (NSUInteger)numberOfPagesInPageViewController:(SCPageViewController *)pageViewController;
- (UIViewController *)pageViewController:(SCPageViewController *)pageViewController viewControllerForPageAtIndex:(NSUInteger)pageIndex;

######Check out the demo project for more details.

License

SCPageViewController is released under the MIT License (MIT) (see the LICENSE file)

Contact

Any suggestions or improvements are more than welcome. Feel free to contact me at [email protected] or @stefanceriu.

scpageviewcontroller's People

Contributors

stefanceriu avatar

Watchers

Carabineiro 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.