使您的视图控制器继承LTSlidingViewController,在viewDidLoad方法中
self.animator = [[LTSlidingViewCoverflowTransition alloc]init]; // set the animator
UIViewController *vc1 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc"];
UIViewController *vc2 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc"];
UIViewController *vc3 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc"];
[self addChildViewController:vc1];
[self addChildViewController:vc2];
[self addChildViewController:vc3];
您可以在子类控制器中调用的有些有用方法
- (void)scrollToPage:(NSInteger)page animated:(BOOL)animated;
- (void)removeAllChildViewControllers;
- (void)didScrollToPage:(NSInteger)page;
@end
您可以通过实现LTSlidingViewTransition协议来创建自定义过渡
@protocol LTSlidingViewTransition <NSObject>
- (void)updateSourceView:(UIView *) sourceView destinationView:(UIView *) destView withProgress:(CGFloat)progress direction:(SlideDirection)direction;
@end
请查看示例以了解更多详情~