Git Product home page Git Product logo

mfwalkthrough's Introduction

MFWalkthrough

Build Status Version

Blog post

MFWalkthrough: A Container View Controller for iOS

Installation

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

pod "MFWalkthrough", "~> 0.0.2"

Demo

You can find the sample project in Example/WalkthroughDemo.

Demo

Usage

Display walkthrough containing 3 view controllers

  • MFWalkthroughDataSource - Used to determine what property to observe to enable transitions
  • MFWalkthroughDelegate - React to various transitions and states
#import <MFWalkthrough/MFWalkthroughViewController.h>

@interface ViewController : UIViewController <MFWalkthroughDataSource, MFWalkthroughDelegate>

In the implementation,

// Initialize your view controllers
UIViewController *firstController;
UIViewController *secondController;
UIViewController *lastController;

// Create the MFWalkthroughViewController instance
MFWalkthroughViewController *walkthroughController =
      [[MFWalkthroughViewController alloc]
          initWithViewControllers:@[ firstController, secondController, lastController ]];

// Present the walkthrough controller
[self.navigationController pushViewController:walkthroughController
                                       animated:YES];

Required data source method:

- (NSString *)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController enableContinuePropertyForViewController:(UIViewController *)viewController {
  return @"somePropertyThatDeterminesIfContinueIsEnabled";
}

Required delegate methods:

- (void)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController willGoBackFromFirstViewController:(UIViewController *)firstViewController {
  NSLog(@"I'm at the very beginning!");
}

- (void)walkthroughViewController:(MFWalkthroughViewController *)walkthroughViewController willContinueFromLastViewController:(UIViewController *)lastViewController {
  NSLog(@"I'm at the very end!");
}

The following delegate methods are optional:

  • - (void)walkthroughViewController:couldNotContinueFromViewController:
  • - (void)walkthroughViewController:willContinueFromViewController:toViewController:
  • - (void)walkthroughViewController:willGoBackFromViewController:toViewController:

Refer to source documentation for more detail

Customization

MFWalkthrough is designed to be used in conjunction with UINavigationController, simplifying conditional transitions between view controllers depending on some intermediate state.

FRDLivelyButton is used to render the navigation buttons. You can customize the button colors and line widths via the following MFWalkthroughViewController properties:

  • (UIColor *)navigationButtonColor - Defaults to navigationBar.tintColor
  • (CGFloat)navigationButtonLineWidth - Defaults to 3.0f

Testing

To run the unit tests:

$ cd Example
$ make install
$ make ci

Author

Mark Fayngersh, [email protected]

License

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

mfwalkthrough's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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