我有三个观点,
View1 <-- View2 --> View3
现在leftSWipeGesture
上的View2会将我发送到VIew3,而右手势会发送到View1
我的问题是,LeftGesture
工作正常但不是正确的姿势。我正在使用push Segue
这是我的代码
- (void) screenSwiped
{
[self performSegueWithIdentifier:@"tourSegue1" sender:self];
}
- (void) screenSwipedRight
{
[self performSegueWithIdentifier:@"tourSegue2" sender:self];
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(screenSwiped)];
swipeLeft.numberOfTouchesRequired = 1;
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeLeft];
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(screenSwipedRight)];
swipeRight.numberOfTouchesRequired = 1;
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRight];
[super viewDidLoad];
}
答案 0 :(得分:1)
您在帖子开头提供的视图结构有点误导。从那个小图中可以看出,你已经在View 2中了,如果你在导航控制器中,那么去View 1应该是一个“popViewController”。
首先 - 请验证这些信息,并确保您不需要“popViewController”而不是performWithSequeIdentifier(因为它不会像那样倒退)。