Partial Curl transition for modal seque in iOS 8

前端 未结 6 842
误落风尘
误落风尘 2020-12-29 08:51

I created simple app with two VCs.
I open second VC from first via button. Seque is \"Present Modally\" and transition is \"Partion Curl\". This scheme works fine on iOS

6条回答
  •  温柔的废话
    2020-12-29 09:04

    You need to find a superview, which contains UIDismissCurlUpTapGestureRecognizer, of the view where you want to disable that gesture recognizer. For exapmle in my case:

    po self.view.superview?.superview?.superview?.gestureRecognizers

    ▿ Optional> ▿ Some : 2 elements - [0] : ; target= <(action=handleNavigationTransition:, target=<UINavigationInteractiveTransition 0x15826e2e0>)>> - [1] : <UIDismissCurlUpTapGestureRecognizer: 0x15838a2c0; state = Possible; view = ; target= <(action=_handleTapToDismissModalCurl:, target=)>>

    So I removed that gesture recognizer, with this part of code:

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
    
        if (self.view.superview?.superview?.superview != nil){
            if (self.view.superview!.superview!.superview!.gestureRecognizers != nil){
                for gestureRecognizer in self.view.superview!.superview!.superview!.gestureRecognizers!{
                    if (gestureRecognizer.isKindOfClass(UITapGestureRecognizer)){
                        self.view.superview!.superview!.superview!.removeGestureRecognizer(gestureRecognizer)
                    }
    
                }
            }
        }
    
    }
    

    Note: it is very important, that you do this in viewDidAppear, because view isn't aware of its superviews earlier in the load cycle.

提交回复
热议问题