Latest 0.1.0
Homepage https://github.com/yichizhang/YZSwipeBetweenViewController
License MIT
Platforms ios 9.0, requires ARC
Frameworks Foundation, UIKit
Authors

A view controller that has a scroll view which contains multiple view controllers’s views; user can swipe left/right to switch to different views.

Screenshot

Install

Simply use CocoaPods:

pod 'YZSwipeBetweenViewController'

Usage

Simple Usage:

@property (strong) YZSwipeBetweenViewController *swipeBetweenVC;

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    self.swipeBetweenVC = [YZSwipeBetweenViewController new];

    UIViewController *vc1 = [DemoMainViewController new];
    UINavigationController *navCon1 =
    [[UINavigationController alloc]initWithRootViewController:vc1];

    UIViewController *vc2 = [DemoMainViewController new];
    UINavigationController *navCon2 =
    [[UINavigationController alloc] initWithRootViewController:vc2];

    UIViewController *vc3 = [DemoMainViewController new];
    UINavigationController *navCon3 =
    [[UINavigationController alloc] initWithRootViewController:vc3];

    self.swipeBetweenVC.viewControllers = @[navCon1, navCon2, navCon3];

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor blackColor];
    [self.window setRootViewController:self.swipeBetweenVC];
    [self.window makeKeyAndVisible];

    return YES;
}

You can change the view controllers:


self.swipeBetweenVC.viewControllers = newViewControllers;
[self.swipeBetweenVC reloadViewControllers];

Scroll to a view controller at an index:


//Switch to the first view controller
[self.swipeBetweenVC scrollToViewControllerAtIndex:0 animated:YES];

//Switch to the second view controller
[self.swipeBetweenVC scrollToViewControllerAtIndex:1 animated:YES];

//Switch to the third view controller
[self.swipeBetweenVC scrollToViewControllerAtIndex:2 animated:YES];

Latest podspec

{
    "name": "YZSwipeBetweenViewController",
    "version": "0.1.0",
    "summary": "A view controller that enables user to swipe left or right to switch to different views.",
    "homepage": "https://github.com/yichizhang/YZSwipeBetweenViewController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Yichi Zhang": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yichizhang/YZSwipeBetweenViewController.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "Source/*.{swift}",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This