0

我有三种观点,

View1 <-- View2 --> View3

现在 View2 onleftSWipeGesture将把我发送到 VIew3 而在右侧 Gesture 发送到 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];

}
4

1 回答 1

1

您在帖子开头呈现的视图结构有点误导。从那个小图中,您似乎已经在视图 2 中,如果您在导航控制器中,则转到视图 1 应该是“popViewController”。

所以首先 - 请验证此信息并确保您不需要“popViewController”而不是 performWithSequeIdentifier(因为它不能像那样倒退)。

于 2012-09-01T16:06:03.013 回答