lkzhao / ElasticTransition

A UIKit custom transition that simulates an elastic drag. Written in Swift.
MIT License
2.18k stars 177 forks source link

Dragging View issue #29

Open marcelocotrim opened 8 years ago

marcelocotrim commented 8 years ago

Sometimes when dragging a view (presenting and dismissing), the app "freezes" and we can't navigate to other views.

delphi-2015 commented 8 years ago

The same problem I had meet. It happened when dragging fast from edge in you demo. It "freezes" cause of the view above the windows like the image attached: Could you help to fix it! Thanks a lot😃 wechatimg2

bramroelandts commented 7 years ago

I am having this exact same issue. Since this issue makes the library almost useless (it happens like 1 out of 3 times), would it be possible to fix this issue? I'd love to dig into the code and fix it myself, but I have no clue where to look..

Thanks a lot for the awesome library though!

lkzhao commented 7 years ago

@brammahh Can you upload your project so I can checkout how you have implemented. I am not seeing this in the example project.

bramroelandts commented 7 years ago

Jurista.zip

In attachement, you can find my project. After clicking 'Start app', you can drag left and right for the menu's to appear. If you drag them fast enough one after the other, the app freezes from time to time.

Thanks in advance!

JazzBallet commented 7 years ago

I have the exact same problem as you. I can't seem to find a good way to reproduce it, but I happens often enough to make the app unsubmitable. Unfortunately I don't have a clue so any suggestions is highly appreciated.

lkzhao commented 7 years ago

I will reimplement this lib as as Hero plugin once Hero supports overFullScreen presentation. That would help eliminate these bugs and make it support navigationController. For now I don't have a work around.

JazzBallet commented 7 years ago

@lkzhao cool, thank you for the swift reply. Unfortunately, I'm not skilled enough to give any valuable input. It's just too bad I really like this transition and build my app around, but might need to find something else.

anysome commented 7 years ago

I found that was because the animation completion block not been called, if dragging too fast or too often, and then transition did no clean works. I add a timer to check it, but not a good idea.

mrdavidrees commented 7 years ago

@lkzhao Any chance you can look into this again? This issue has been around for more than a year now.

mrdavidrees commented 7 years ago

@lkzhao

If this helps I think i've identified the issue and the fix:

 override func cancelInteractiveTransition(){
    super.cancelInteractiveTransition()
    let finalPoint = self.finalPoint(!presenting)

    print("running cancel animation")
    lc.m_animate("center", to: finalPoint, stiffness: animationSideStiffness, damping: animationDamping, threshold: animationThreshold)
    cc.m_animate("center", to: finalPoint, stiffness: animationCenterStiffness, damping: animationDamping, threshold: animationThreshold){
      self.cc.center = finalPoint
      self.lc.center = finalPoint
      self.updateShape()
      self.clean(false)
      print("cancel animation ran") //not being called because it's already a the final point
    }

    if cc.center == finalPoint {
        print("already there")
        self.cc.center = finalPoint
        self.lc.center = finalPoint
        self.updateShape()
        self.clean(false)
    }
  }
MaisaMilena commented 7 years ago

@mrdavidrees I used your code and totally worked! Thanks

QuyetND commented 5 years ago

@lkzhao: Did you implement Elastic Transition is a part of Hero? I download it but no find Elastic mode in it. I download Elastic Transition and convert it to swift 5 and fix some bug but still some bug about wrong frame (navigation and safe area update after viewcontroller showed) when present viewcontroller type top and bottom, but left and right work perfect. transition.edge = .top transition.startingPoint = (sender as AnyObject).center performSegue(withIdentifier: topIdSegue, sender: self) And some time viewcontroller frezze because of TransitionView in top layer (I fixed it follow other post issuse) but sometime it still frezze. Sorry for my bad English.

yunustek commented 3 years ago

And some time viewcontroller frezze because of TransitionView in top layer (I fixed it follow other post issuse) but sometime it still frezze.

I agree