Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
274 views
in Technique[技术] by (71.8m points)

ios - How to go back to current View Controller?

I am implementing ECSlidingViewController in my app. Everything works fine, when I hit the menu button (UIBar) the left menu slides. But pressing the menu button again does not bring back the current ViewController.

It works in the sample app, but I cannot find that line of code that brings back the current controller.

Here is the code to show the menu:

- (IBAction)menuButtonTapped:(id)sender {
    [self.slidingViewController anchorTopViewToRightAnimated:YES];
}

Now I am looked everywhere for the part of the code that can dismiss the left menu layout but could not find it. It must be burry somewhere...

Github project

How do you get back to the current View Controller by pressing the Menu UIBar button ?


@Eric opened my eyes on what is performing that event. It seems like the UIPanGestureRecognizer is the one responsible to redisplay the main screen, unfortunately I couldnt get it to work after implementing that deleguate.

- (UIPanGestureRecognizer *)dynamicTransitionPanGesture {
    if (_dynamicTransitionPanGesture) return _dynamicTransitionPanGesture;

    _dynamicTransitionPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self.transitions.dynamicTransition action:@selector(handlePanGesture:)];

    return _dynamicTransitionPanGesture;
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are probably looking for the following line:

self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;

in METransitionsViewController.m in the example TransitionFun project.

This controls how the Top View behaves to gestures while it is anchored to the side. You can refer to Anchored Top Views Gesture for more info.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...