Like button animation similar to Zhihu

Like button animation similar to Zhihu

Source code introduction:

NumberScrollAnimatedView.swift This file encapsulates the animation effect similar to the counter and can be used separately.

The ZanButton.swift file encapsulates the entire like animation process. Just find a UIView and set it to this class.

For details, please see the project's comments and examples.

PS PopView with arrows has not been implemented yet, it should not be difficult. I will continue to improve it next time

Source code effect:

Source code snippet:

  1. <br>
  2. <br>
  3. /**<br>
  4. * Set the like action<br>
  5. */ <br>
  6. zanView.zanAction = {(zhanNumber)->Void in<br>
  7. self.label.text = "(zhanNumber)" <br>
  8. self.label.textColor = UIColor(red: 0.098 , green: 0.565 , blue: 0.827 , alpha: 1 )<br>
  9. }<br>
  10. <br>
  11. /**<br>
  12. * Set the action to cancel the like<br>
  13. */ <br>
  14. zanView.unzanAction = {(zhanNumber)->Void in<br>
  15. self.label.text = "(zhanNumber)" <br>
  16. self.label.textColor = UIColor.blackColor()<br>
  17. }<br>
  18. <br>
  19. //Set the initial value<br>  
  20. zanView.initNumber = 5 <br>
  21. <br>

Download address: http://download..com/data/2070284

<<:  Material Design: Flat but not level

>>:  A brief analysis of the conspiracy theory behind the App Store's 1 Yuan selection

Recommend

BAT is struggling to survive. Who says shopping guides have no vitality?

On May 15, Taobao made a new move. Alimama issued...

6 ways to monetize community operations

I always encourage you to build communities becau...

Photography class by Chen Yu

Introduction to Chen Yu’s photography class resou...

How to build a p2p product operation strategy from 0 to 1?

Having been in the Internet finance industry for ...

Nobel Prize winner warns: The fate of birds is our fate

With the sales of this little book, I would like ...

Does it really not matter whether Google Glass wins or loses?

It is undeniable that there have been many debate...

How old is your earliest memory? Why can't you remember anything before that?

When you were a child, you chewed your feet, ate ...

How to develop a desktop app using Electron

Have you ever thought that you can use HTML, CSS ...