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

"Black hat SEO spinach quick ranking" Hubei SEO website ranking optimization skills!

「Black hat SEO spinach quick ranking」 Hubei SEO w...

Green Onion Metal Standard Edition Review: A Transformation, Two-thirds Success

The mobile phone market has long been a bloody ba...

How to carry out promotion operations? Share 10 tips!

The era of the entire network has arrived, and on...

The color TV industry is still the same and there is no story to tell

The color TV market in the first half of 2016 (th...

TikTok anchor PK strategy and skills

5 Tips for Hosts to Connect with MCs 16 game cont...

Four major marketing tactics for Children’s Day!

Non-high-energy warning: Another Children's D...