我现在用presentModalViewController跳转,用 [self dismissModalViewControllerAnimated:YES];取消页面
这个方法实现了要求,但是还是疑惑原来的问题。求知道的大神告知,给个提示也好。

解决方案 »

  1.   

    手势会在每次状态变化时调用回调方法,所以你需要再判断手势结束时再push。修改下你的方法,这样可以拿到手势参数。
      

  2.   


    +1试了一下,longpressView最少会被调用两次,一次是手势开始,另一次是手势被 cancel,控制台会提示下面的错误信息:
    nested push animation can result in corrupted navigation bar
    Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
    Unbalanced calls to begin/end appearance transitions for 
    ……所以解决方案是,修改longpressView如下:-(void)longpressView:(UIGestureRecognizer*)recognizer
    {
        if (recognizer.state==UIGestureRecognizerStateRecognized) {
            TestDemoViewController *testDemo = [[TestDemoViewController alloc] init];
            [self.navigationController pushViewController:testDemo animated:YES];
        }
    }
    PS: 记得修改手势创建时对应的 selector
      

  3.   


    +1试了一下,longpressView最少会被调用两次,一次是手势开始,另一次是手势被 cancel,控制台会提示下面的错误信息:
    nested push animation can result in corrupted navigation bar
    Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
    Unbalanced calls to begin/end appearance transitions for 
    ……所以解决方案是,修改longpressView如下:-(void)longpressView:(UIGestureRecognizer*)recognizer
    {
        if (recognizer.state==UIGestureRecognizerStateRecognized) {
            TestDemoViewController *testDemo = [[TestDemoViewController alloc] init];
            [self.navigationController pushViewController:testDemo animated:YES];
        }
    }
    PS: 记得修改手势创建时对应的 selector我猜的也是调用问题,但是就不知道怎么解决。太感谢了