0
我有三个观点,添加多个swipeGestures不工作
View1 <-- View2 --> View3
现在视图2上leftSWipeGesture
会送我去VIEW3而在右手势发送到VIEW1
我的问题是,LeftGesture
工作正常但不是正确的姿态。我使用两个
推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];
}
看,我使用SwipeGestureRecognize UI从View1到View2。没有导航。我唯一回到视图1的方法是转到视图3,然后从视图3调用函数返回到视图1。但我甚至无法前往View3。如果你有更好的解决方法,请告诉我 –
你能告诉我怎么做popviewcontroller。再次我没有做navigationController –
[self.navigationController popViewControllerAnimated:YES];但是,如果你使用的是导航控制器。如果您使用的是seques,那么无论您使用的是navigationController,无论是在代码中定义还是使用Storyboard,都可能更有可能。 – Brayden