Shake on iPhone

Shake on iPhone

Source code introduction: It is very simple to implement the shake function on iPhone. Please refer to the following code or download the demo to try it out.

Source code effect:

[[142753]]

Source code snippet:

  1. #pragma mark - shake
  2.  
  3. /**
  4. * Shake to start
  5. */  
  6. - ( void )motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
  7.  
  8. if (motion == UIEventSubtypeMotionShake) {
  9.  
  10. NSLog(@ "Started shaking" );
  11. }
  12. }
  13.  
  14. /**
  15. * Shake ends
  16. */  
  17. - ( void )motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
  18.  
  19. NSLog(@ "Shake ended" );
  20. }
  21.  
  22. /**
  23. * Shake to cancel
  24. */  
  25. - ( void )motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event {
  26.  
  27. NSLog(@ "Shake to cancel" );
  28. }

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

<<:  Different ways to deal with girls acting like a spoiled child

>>:  Learning Numerical Algorithms with Playground

Recommend

How do overseas Chinese restaurants obtain WeChat mini-program authentication?

Q: How do overseas Chinese restaurants authentica...

How to break through in brand marketing?

1. Market Segmentation In today's diversified...

"Muscle" cannot be lost, the key to preventing "muscle" is...

As the saying goes, “A slim body in old age is wo...

How to analyze a product from an operational perspective?

In this article, I will provide a set of thinking...

Several existing problems and solutions for App Store search

Apple's volatility has only increased recentl...

3 elements of APP operation and promotion strategy!

All resources have a focusing effect. For product...

WordPress website (relocation) moving tutorial

WordPress website (relocation) moving tutorial Mo...

What is Baidu weight? 6 ways to improve Baidu's weight!

For SEO personnel, when we judge whether a websit...

How to establish a membership operation system?

In a broad sense, all manual interventions around...

How to capture users from the new Internet model

The Internet model from 2012 to 2015 mainly consi...

The CTR is the same, which copy has a better conversion rate?

Have you ever encountered such accounts in the pr...