Ios 手势滑动-情节提要序列

Ios 手势滑动-情节提要序列,ios,gesture,uiswipegesturerecognizer,Ios,Gesture,Uiswipegesturerecognizer,一直在阅读手势滑动以及如何根据方向打开或关闭UIView。我只是想到了一个我没能解决的问题。我可以识别触摸事件,即上、下、左、右。然而,当我尝试切换到另一个屏幕(在故事板中)时,我收到一个非常模糊的错误,我不知道从哪里开始。我已经看到其他应用程序这么清楚地做到了这一点,只是没有找到正确的图坦卡蒙或例子。下面是代码,如果有人有想法的话 - (void)viewDidLoad { UISweepGestureRecognizer*swipeUp=[[UISweepGestureRecognizer

一直在阅读手势滑动以及如何根据方向打开或关闭UIView。我只是想到了一个我没能解决的问题。我可以识别触摸事件,即上、下、左、右。然而,当我尝试切换到另一个屏幕(在故事板中)时,我收到一个非常模糊的错误,我不知道从哪里开始。我已经看到其他应用程序这么清楚地做到了这一点,只是没有找到正确的图坦卡蒙或例子。下面是代码,如果有人有想法的话

- (void)viewDidLoad
{ UISweepGestureRecognizer*swipeUp=[[UISweepGestureRecognizer alloc]initWithTarget:self action:@selector(didSwipe:)]; swipeUp.numberoftouchsrequired=1; swipeUp.direction=uiswipgesturerecognizerDirectionUp; [self.view addgesturecognizer:swipeUp]

UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(didSwipe:)];
swipeDown.numberOfTouchesRequired = 1;
swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:swipeDown];

UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(didSwipe:)];
swipeLeft.numberOfTouchesRequired = 1;
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeLeft];

UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(didSwipe:)];
swipeRight.numberOfTouchesRequired = 1;
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRight];

[super viewDidLoad];
// Do any additional setup after loading the view.
//[self.view removeGestureRecognizer:swipeUp]; //[self.view removeGestureRecognizer:swipeDown]; //[self.view RemovegestureRecognitor:swipeLeft]; //[self.view removeGestureRecognizer:swipeRight]; }


你能显示错误吗?顺便说一句,你为什么不使用一个简单的表演序列呢?这是另一个故事板吗?嗨,Shannoga,是的,我在键入这条消息时试图重现错误。正常的segue工作正常,但当你转到上一个屏幕时,它会中止。我认为这与确定其来源有关,即上一屏幕、下一屏幕场景。我将在可以再次执行错误时尽快发布错误。收到错误:线程1:EXC_BAD_ACCESS(代码=2,地址=0x100)。当您将手指指向正确方向,然后返回时,会发生这种情况。我想我可能需要为我想要操纵的每个视图创建一个新的.h/.m类,然后告诉视图它来自何处以及它将要去何处。我想…收到错误:**由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无效参数不满足:[标识符长度]>0”我看到的一个常见特征是,如果任何方向的手势超过3次,则会失败。我认为它需要以某种方式释放…你能在检测到任何刷卡后立即尝试移除手势识别器吗?
FirstViewController *fvc;
-(void)didSwipe: (UISwipeGestureRecognizer *) sender
{
    UISwipeGestureRecognizerDirection direction = sender.direction;

    switch (direction)
    {
        case UISwipeGestureRecognizerDirectionRight:
            NSLog(@"you swiped the screen right");
            [self performSelector:@selector(goRight:)];
            break;

        case UISwipeGestureRecognizerDirectionLeft:
            NSLog(@"you swiped the screen left");
            [self performSelector:@selector(goLeft:)];
            break;

        case UISwipeGestureRecognizerDirectionDown:
            NSLog(@"you swiped down");
            //[self performSelector:@selector(goDown:)];
            break;

        case UISwipeGestureRecognizerDirectionUp:
            NSLog(@"you swiped Up");
            //[self performSelector:@selector(goUp:)];
            break;

        default:
            break;
    }
}

-(void)goRight:(id)sender
{
    UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"ip5" bundle:[NSBundle mainBundle]];
    UIViewController* controller = [storyboard instantiateViewControllerWithIdentifier:@"FirstView"];
    controller.transitioningDelegate  = self;
    [self presentViewController:controller animated:YES completion:nil];
}