yzs

YZSwipeBetweenViewController

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.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

77

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

0

License

MIT

Categories

Readme

YZSwipeBetweenViewController

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];

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100