ECSlidingViewController with UITabBarController

591 views Asked by At

I have a requirement where I need to slide the view but thats inside a UITabBarController.

Does any one tried doing that ? ECSlidingViewController works perfect if I make it rootViewController but I want that in UITabBarController.

I tried setting the ECSlidingViewController as one of the view controllers for the UITabBarController but it keeps crashing after the first swipe or some times it goes in infinite loop

Below is my code

    myWorkController = [[TaskWorkViewController alloc] initWithNibName:@"WorkViewController_iPhone" bundle:nil]; // This is the controller where I have my specific logic

    myWorkNavController = [[[UINavigationController alloc] initWithRootViewController:myWorkController] autorelease]; // setting the myWorkController to UINavigationController as I need to navigate from this view controller to different view on specific actions

//SlidingviewController setup self.slidingViewController = [ECSlidingViewController slidingWithTopViewController:myWorkNavController];

    self.slidingViewController.topViewController = myWorkNavController;
    [myWorkNavController.view addGestureRecognizer:self.slidingViewController.panGesture];
    self.slidingViewController.anchorRightPeekAmount  = 100.0;
    myWorkController.slidingViewController = self.slidingViewController;

UITabBarController *tabBarController = [[UITabBarController alloc] init];
    tabBarController.viewControllers = @[ self.slidingViewController, createNavController, currentWorkNavController];

and I am setting the underRightViewController inside myWorkController

 if (self.slidingViewController != nil)
    {

        UIViewController *underRightViewController = [[[UIViewController alloc] init] autorelease];
        // configure under right view controller
        underRightViewController.view.layer.borderWidth     = 0;
        underRightViewController.view.layer.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0].CGColor;
        underRightViewController.view.layer.borderColor     = [UIColor colorWithWhite:0.8 alpha:1.0].CGColor;
        underRightViewController.edgesForExtendedLayout     = UIRectEdgeTop | UIRectEdgeBottom | UIRectEdgeRight; // don't go under the top view
        self.slidingViewController.underRightViewController = underRightViewController;
    }

1) First swipe works perfect but the second swipe breaks in ECSlidingViewController code 2) As I am using UINavigationController, when I try to change underRightViewController it fails at [oldUnderRightViewController removeFromParentViewController]; of ECSlidingViewController code

Can some one please guide me what I am doing wrong or if this is possible with ECSlidingViewController

Thanks in advance

0

There are 0 answers