Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not always work #25

Closed
phlippieb opened this issue Jan 23, 2019 · 8 comments · Fixed by #27
Closed

Does not always work #25

phlippieb opened this issue Jan 23, 2019 · 8 comments · Fixed by #27

Comments

@phlippieb
Copy link

For my use case, I want to add this effect to a view controller just after it has been pushed to a navigation stack. Strangely, sometimes when the VC is pushed, the confetti effect is not shown at all.

I created an example project that demonstrates the issue. To see it in action:

  1. Clone or download the project
  2. pod install
  3. Run the project in Xcode

The example app has a 'continue' button in the centre of the screen. Tapping it will navigate to a new screen with the confetti effect enabled. After going back and forth between the two screens a few times, the effect will randomly fail to display.

@thedore17
Copy link

Same here. A lot of times CheerView doesn't start on start. Any workarounds?

@onmyway133
Copy link
Owner

onmyway133 commented Mar 5, 2019

@phlippieb Hi, if you call start method as part of button touch action or delay a bit using DispatchQueue, does that work?

@phlippieb
Copy link
Author

phlippieb commented Mar 5, 2019

@onmyway133 I've added a delay around start (using DispatchQueue.main.asyncAfter(.now() + 10)). It had no effect; the confetti still fails to start sometimes, and often on the first time.

My use case is that the confetti should start automatically once a screen becomes visible, so testing with a button doesn't interest me (nor does waiting 10 seconds but it was easy to test 🙂 ).

The example project I included is extremely simple and only uses your library as a pod, so it should give you everything you need to debug the issue.

@jbuckner
Copy link
Contributor

I was also running into this issue and did some digging into it. It turns out you have to set the beginTime on the CAEmitterCells instead of the CAEmitterLayer. I opened #27 to fix.

@onmyway133
Copy link
Owner

@phlippieb The PR from @jbuckner was merged, can you check master branch to see if it works for you?

@phlippieb
Copy link
Author

@onmyway133 I can confirm that the fix works 🎉

@onmyway133
Copy link
Owner

@phlippieb cool, I will make new release soon

@onmyway133
Copy link
Owner

New release is out https://github.com/onmyway133/Cheers/releases/tag/2.3.0, thanks a lot for contributing @phlippieb @jbuckner ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants