seema
seema

Reputation: 11

How to make an application perform an action whenever a shake is detected?

I want to know the way to display images whenever the iPhone detects a shake.The images would be those stored in a folder in the iPhone. A source code would really be helpful.

Upvotes: 1

Views: 122

Answers (1)

Rakesh Bhatt
Rakesh Bhatt

Reputation: 4606

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
      if (event.subtype == UIEventSubtypeMotionShake) {
                // The user shook the device
      }
}

Upvotes: 3

Related Questions