Question

I'm trying to set my sliding transition with Zoom Animation in ECSLidingViewController2.

Like in the TransitionFun example (https://github.com/ECSlidingViewController/ECSlidingViewController/blob/master/Examples/TransitionFun/TransitionFun/METransitionsViewController.m), I'm doing this in viewDidLoad of my topView NavigationController:

id<ECSlidingViewControllerDelegate> transition = [[MEZoomAnimationController alloc] init];
self.slidingViewController.delegate = transition;

self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
self.slidingViewController.customAnchoredGestures = @[];
[self.navigationController.view removeGestureRecognizer:self.dynamicTransitionPanGesture];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];

I'm adopting the ECSlidingViewControllerDelegate protocol in the NavigationController header file.

But it crashes in the ECSlidingViewController.m, at the first if condition of this method I get an EXC_BAD_ACCESS(1) error:

- (CGRect)frameFromDelegateForViewController:(UIViewController *)viewController
                         topViewPosition:(ECSlidingViewControllerTopViewPosition)topViewPosition {
     CGRect frame = CGRectInfinite;

     if ([(NSObject *)self.delegate respondsToSelector:@selector(slidingViewController:layoutControllerForTopViewPosition:)]) {
    id<ECSlidingViewControllerLayout> layoutController = [self.delegate slidingViewController:self
                                                           layoutControllerForTopViewPosition:topViewPosition];

    if (layoutController) {
        frame = [layoutController slidingViewController:self
                                 frameForViewController:viewController
                                        topViewPosition:topViewPosition];
    }
}

return frame;

}

Anyone having the same issue? thx

Was it helpful?

Solution

This is what i do in the viewDidLoad: method of my view controller and it works great:

id<ECSlidingViewControllerDelegate> transition = self.zoomAnimationController;
self.slidingViewController.delegate = transition;
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
self.slidingViewController.customAnchoredGestures = @[];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];

If, like me, you aren't trying to implement the dynamic transition, you should get rid of the line you have that says:

[self.navigationController.viewremoveGestureRecognizer:self.dynamicTransitionPanGesture];

IMHO its what could be causing your EXC_BAD_ACCESS(1) error since you haven't actually set the dynamicTransitionPanGesture gesture recognizer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top