带有UITabBarController的ECSlidingViewController

时间:2013-12-04 19:37:44

标签: ios ecslidingviewcontroller

我有一个要求,我需要在UITabBarController中滑动视图。

有人试过这样做吗?如果我将它设为rootViewController,ECSlidingViewController工作正常,但我想在UITabBarController中使用它。

我尝试将ECSlidingViewController设置为UITabBarController的一个视图控制器,但它在第一次滑动后或有时无限循环时仍会崩溃

以下是我的代码

    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设置         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];

我正在myWorkController中设置 underRightViewController

 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)第一次滑动工作完美,但第二次滑动在ECSlidingViewController代码中断 2)当我使用UINavigationController时,当我尝试更改underRightViewController时,它在[oldUnderRightViewController removeFromParentViewController]失败; ECSlidingViewController代码

有人可以指导我做错了或者ECSlidingViewController是否可行

提前致谢

0 个答案:

没有答案