Hi Friends,
I know there are several applications which are using Slide Menu option. You can find several libraries or classes in Objc to build an app like that.
Here is the most easy and customizable class to get it. Its name is SKSlideViewController. Here is the code you need to use in your project and also not forget to include attached files in your project folder.
Instructions
- Import this file on top of your code file #import "SKSlideViewController.h".
- Add its delegate "slidinglistviewdelegate"
- Create an object or property like this:- SKSlideViewController *skslidecontroller;
Copy below code :
-(void)setupSlideMenuController{
UIStoryboard *storyBoard=[self storyboard];
ViewController1 *mainController=[storyBoard instantiateViewControllerWithIdentifier:@"ViewController1"];
// TestViewController *leftController=[storyBoard instantiateViewControllerWithIdentifier:@"TestController"];
ViewController2 *rightController=[storyBoard instantiateViewControllerWithIdentifier:@"ViewController2"];
SKSlideViewController *controller= [segue destinationViewController];//[[SKSlideViewController alloc] init];
mainController.slideController = controller;
rightController.slideController = controller;
[controller setSlideViewControllerUsingMainViewController:[self getNav:mainController] leftViewController:nil rightViewController:[self getNav:rightController]];
[controller setSlideControllerStyleMask:SKSlideControllerStyleRevealRight];
[controller setHasShadow:YES];
[controller reloadControllers];
[controller setSlidesOnPanGesture:YES];
[self.navigationController setNavigationBarHidden:YES];
}
-(UINavigationController *)getNav:(UIViewController *)viewCnt{
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:viewCnt];
return nav;
}
Happy Coding!!!
0 Comment(s)