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