MMLoadingButton icon indicating copy to clipboard operation
MMLoadingButton copied to clipboard

Calling stopLoading while startLoading animation is running makes button stuck in loading state

Open edyanosik-orion opened this issue 7 years ago • 2 comments

If you call stopLoading on the button before the animation for startLoading is finished, the CAAnimationDelegate's animationDidStop for "ShrinkStart" sets the stateLayer's currentState to ".loading" even though stopLoading set the state to success or error and so the button gets stuck in the loading state.

It's annoying and unideal for the user to have to add delays before stopping the loading.

edyanosik-orion avatar May 15 '17 19:05 edyanosik-orion

Any progress on this? just started using this and ran into it almost immediately. Some of my network calls are really quick and it seems to not call the completion handler when this occurs.

molynerd avatar Aug 06 '17 20:08 molynerd

If you put a delay (it's a hack) it works.

DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
       <#CODE HERE#>
}

I'm thinking is send pull request soon with my solution if anyone still need

lfap avatar Aug 23 '18 16:08 lfap