ThornTechPublic / InteractiveModal

MIT License
148 stars 36 forks source link

UIPanGestureRecognizer only returns state Began and Cancelled when I put ModalViewController in an UINavigationController #3

Open thaiduy opened 8 years ago

thaiduy commented 8 years ago
  1. In your example, you're presenting ModalViewController as following flow in storyboard: ViewController --(present modally segue)--> ModalViewController
  2. In my case, I need to present ModalViewController in a UINavigationController, so i set up my storyboard as following flow: ViewController --(present modally segue)--> UINavigationController --(relationship root view controller)--> ModalViewController

In case (1), panGestureRecognizer will return all available states: Began, Changed, Cancelled, Ended. But in case (2), it will only return Began and Cancelled. Do you have any idea why it happened and how to fix it?

Thank you!

thaiduy commented 8 years ago

Finally I make it working by setting UINavigationController's transitioningDelegate to ViewController

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    UINavigationController *nav = segue.destinationViewController;
    if (nav && [nav isKindOfClass:[UINavigationController class]]) {
        ModalViewController *desVC = nav.viewControllers[0];
        nav.transitioningDelegate = self;
        [desVC setInteractor:_interactor];
    }
}

But when I drag the ModalViewController around without completely dismissing it for some times, the UI get frozen, no logs, no errors message, nothing on the console window.