Partial Curl transition for modal seque in iOS 8

前端 未结 6 823
误落风尘
误落风尘 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.

    0 讨论(0)
  • 2020-12-29 09:11

    I have the same problem. I saw it in Xcode 6 (beta 7) + iOS 8 (beta 5). Still present in GM seed of both.

    iOS 7.1 Specifics:

    It is called a "partial curl" and on iOS 7 it displays as such (e.g. Partial - you can still see a portion of the originating view along the top of the window). On iOS 7 - when you tap on this partially exposed, "original" view, the view unwindes back to the full window of the origional.

    iOS 8 Specifics:

    The segue does NOT leave any of the original showing. And any tap, anywhere on the window/screen, returns the originating view via an automatic unwind. If you have a UITextField on the view, when you tap on it to enter a value … the originating view returns without triggering any of the associated UITextField methods. No keyboard is displayed, it simply unwinds to the originating view.

    It appears to me, that touch definition associated with what should be a partially displayed corner of the original view is instead mis-defined as the entire window.

    Of course, I'm very new to iOS programming, so my insight, if accurate, does not give me a clue as to how to workaround it! LOL I'm hoping that someone out there will have the knowledge to at least provide a usable workaround.

    Jim

    P.S. I don't yet have enough reputation points to vote or comment, hence my answer that isn't an answer.

    0 讨论(0)
  • 2020-12-29 09:12

    This is either a bug, or (IMHO) an indication from Apple that this ModalTransitionStyle is about to be deprecated. Since it is probably the last vestige of pseudomorphism, I think that's a safe bet that it is short for this world. I was debugging an issue for hours with regards to inconsistent touches on a modally presented viewcontroller, using this transition and pulling my hair out. I switched to another modal transition style and POOF - all issues caused by iOS8 are gone.

    Keith

    0 讨论(0)
  • 2020-12-29 09:18

    simple solution to the this problem is.

    - (void)viewDidAppear:(BOOL)animated
    {
    
        [super viewDidAppear:animated];
    
        for(UIGestureRecognizer *gesture in [self.view gestureRecognizers])
        {
    
            if([gesture isKindOfClass:[UIGestureRecognizer class]])
            {
    
                [self.view removeGestureRecognizer:gesture];
    
            }
    
        }
    
    }
    
    0 讨论(0)
  • 2020-12-29 09:18

    I too chased this BUG for days! It turns out you can still use Partial Curl successfully; the problem only appears if the ANIMATES box is checked. Un-check the ANIMATES box, and you are good to go!

    0 讨论(0)
  • 2020-12-29 09:24

    I had the same issue. Touching anywhere in the top half of screen, caused the modal to close (unwind). Changed the animation and the world was at peace again.

    So, definitely a bug in iOS8.

    0 讨论(0)
提交回复
热议问题