-1

我这里有两种情况。1.从VC1单击按钮,我想移动到VC6,然后向后滑动。这是通过上面提到的代码完成的。2. 我在 VC1 中也有滑动手势移动到 VC2、VC3、VC4、VC5 和 VC6。现在我想从 VC6 滑动回 VC5、Vc4、VC3、VC2 然后到 VC1。我可以分别实现这两个场景。但是我怎样才能一起实现这些场景。

我有六个视图控制器。在viewController1我有一个按钮,可以将我带到viewController6. 然后我从使用代码中分别弹回viewController5, viewController4, viewController3,viewController2viewController1viewController6

    - (IBAction)SwipeGoto5:(UISwipeGestureRecognizer *)sender 
{
    IndexPage *P1VC=[[IndexPage alloc] initWithNibName:@"IndexPage" bundle:nil];
    Page2 *P2VC=[[Page2 alloc] initWithNibName:@"Page2" bundle:nil];
    Page3 *P3VC=[[Page3 alloc] initWithNibName:@"Page3" bundle:nil];
    Page4 *P4VC=[[Page4 alloc] initWithNibName:@"Page4" bundle:nil];
    Page5 *P5VC=[[Page5 alloc] initWithNibName:@"Page5" bundle:nil];

    NSLog(@"swipe to 5");
    NSMutableArray *allViewControllers = [NSMutableArray arrayWithArray: self.navigationController.viewControllers];
    [allViewControllers insertObject:P1VC atIndex:1];
    [allViewControllers insertObject:P2VC atIndex:2];
    [allViewControllers insertObject:P3VC atIndex:3];
    [allViewControllers insertObject:P4VC atIndex:4];
    [allViewControllers insertObject:P5VC atIndex:5];

    self.navigationController.viewControllers=allViewControllers;
    [self.navigationController popViewControllerAnimated:YES];


}

我也有UISwipeGestureRecognizerviewController1我去viewController2,viewController3和. 当我使用on并且我也有上面提到的代码时,我将如何弹出。viewController4viewController6viewController6UISwipeGestureRecognizerviewController1

4

1 回答 1

0

获取滑动手势(从右到左)并在其中编写 popViewController 的代码。

于 2013-01-18T12:14:22.370 回答