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

IEA: Path to a new era of nuclear energy

The IEA has released a new report, “The Road to a...

Wanted to prove Einstein's theory was wrong, but won the Nobel Prize for it

It is said that the Nobel Prize Committee of the ...

Precise positioning of Moments ads, do you want to know how WeChat sees you?

Do you want to know how WeChat sees you? Since th...

Seeing the "bones" of the cosmic ghost hand

Seeing the "bones" of the cosmic ghost ...

The Japanese have acquired ARM, so Apple can switch to MIPS

The biggest news in the technology circle these d...

Zendesk: 2024 Customer Experience Trends Report

Zendesk released the "2024 Customer Experien...

22 Predictions for the Marketing Industry

The marketing industry is changing so fast that i...

2021 China Advertising Industry Cooperation Ecosystem Report!

The cooperative relationship between advertisers ...

Why traffic products are bound to become mediocre

Nowadays, many products are labeled as internet c...