PPRevealSideViewControllerDemo (slide effect), Slide Mobile Phone
Initial diagram:
Slide left, or stroke:
Project files:
MainViewController. h
#import <UIKit/UIKit.h>@interface MainViewController : UIViewController@end
MainViewContoller. m
# Import "MainViewController. h "// Add the header file # import" PPRevealSideViewController. h "# import" leftViewController. h "# import" rightViewController. h "@ implementation MainViewController-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // set the background color self. view. backgroundColor = [UIColor orangeColor]; // hide the navigation bar self. navigationController. navigationBarHidden = YES; // move the screen between the left and right sides of the gesture * swipeLeft = [[using alloc] initWithTarget: self action: @ selector (handleMoveFrom :)]; [swipeLeft setDirection: callback]; [self. view addGestureRecognizer: swipeLeft]; Parameters * swipeRight = [[using alloc] initWithTarget: self action: @ selector (handleMoveFrom :)]; [swipeRight setDirection: callback]; [self. view addGestureRecognizer: swipeRight];} // sliding event-(void) handleMoveFrom :( UISwipeGestureRecognizer *) swipe {if (swipe. direction = uiswipegesturerecognizerdireright) {leftViewController * left = [[leftViewController alloc] init]; [self. revealSideViewController pushViewController: left onDirection: PPRevealSideDirectionLeft withOffset: 50.0 animated: YES];} if (swipe. direction = uiswipegesturerecognizerdireleft) {rightViewController * right = [[rightViewController alloc] init]; [self. revealSideViewController pushViewController: right onDirection: PPRevealSideDirectionRight withOffset: 50.0 animated: YES];}
RightViewController. m
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // set the title self. title = @ "right"; // sets the background color self. view. backgroundColor = [UIColor blueColor];}
LeftViewController. m
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // set the title self. title = @ "left"; // sets the background color self. view. backgroundColor = [UIColor redColor];}