我这里有2个场景。 1.点击VC1按钮,我想移动到VC6,然后向后滑动。这是通过上述代码完成的。 2.我还在VC1中滑动手势以移动到VC2,Vc3,VC4,VC5和VC6。现在我想从VC6刷回VC5,Vc4,VC3,VC2然后再转移到VC1。我可以分别实现这两个场景。但是我怎样才能一起实现这些场景。
我有六个viewControllers。在viewController1
我有一个按钮,可以将我带到viewController6
。然后我使用代码
viewController5
回到viewController4
,viewController3
,viewController2
,viewController1
和viewController6
- (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];
}
我UISwipeGestureRecognizer
上还有viewController1
,它带我到viewController2
,viewController3
,viewController4
以及viewController6
。当我在viewController6
上使用UISwipeGestureRecognizer
并且我也有上述代码时,我将如何从viewController1
回弹。
答案 0 :(得分:0)
获取滑动手势(从右到左)并在其中编写popViewController的代码。