Slide Menu in IPhone App using ECSlidingViewController

127 Views Asked by At

I am trying to use ECSlidingViewController in my Iphone app (Using Storyboard).

I have 5 ViewControllers.
Login
MainSelection
FirstView
SecondView
MenuView

In the above controllers i have "Menu" Button on FirstView & SecondView on click of "Menu" button i want to slide the MenuView data and again on clicking on the button close the slide menu.

I went through samples from github ECSlidingViewController.I am referring the same code as shown in github examples.I am trying to integrate in my exisitng app.

Question: I tried to create InitialSlidingViewController subclass of ECSlidingViewController.But i cannot set this as InitalViewController in storyboard.Because my existing initialviewcontroller is "Login" view controller. Is there a way i can initialize SlidingViewController in "Main" view controller and by using slidingViewController.leftViewController open the slide menu when the menu button is tapped.

Here my main issue is i cannot set the InitialSlidingViewController subclass of ECSlidingViewController as InitialViewController.So what are the possible options to enable sliding for "Menu" button click on MainView.

Note: If i set the InitialSlidingViewController as InitialViewController in storyboard and providing respective topviewStoryboardID and leftViewStoryBoardID as runtime attributes it is working as expected.But this is not the way i am trying to integrate in my app.

Thanks in advance

1

There are 1 best solutions below

1
On

It's very difficult to diagnose issues like this without seeing sample code.
What I will say, having worked with ECSlidingViewController in the past, is that you should be checking for login credentials in your AppDelegate.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    if (userHasCredentials) {
        [self loadNavigationControllerThatHasECSlidingViewController];  
    } else {  
        [self loadViewControllerThatHasLoginFlow];  
    }  
    return YES;
}  

The idea is that by keeping your LoginViewController outside of the navigation controller tree for ECSlidingViewController, you don't have to present that navigation controller until you've successfully completed the login flow.