Tutorial details

Shake Gesture | App Code for Sale | Preview

Shake Gesture | iOS Tutorial

How to use the shake gesture

Overview PAGE TOP

Reference: http://www.geekylemon.com/WEBPROTECT-xcodeshakegesture.htm

In this tutorial i will be showing you how to use the shake gesture


  • 1 Label

Using the shake gestures requires the user to shake there device and can be used just like pressing a button where an action is created such as playing a sound or switching views

ViewController.h PAGE TOP

@interface ViewController :UIViewController {
IBOutlet UILabel *label;

ViewController.m PAGE TOP

@implementation ViewController
-(BOOL)canBecomeFirstResponder {
return YES;
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {  
if (event.subtype == UIEventSubtypeMotionShake) {
label.text = @"The App Is Shaking";
- (void)viewDidAppear:(BOOL)animated {
    [self becomeFirstResponder];
    [super viewDidAppear:animated];
- (void)viewWillDisappear:(BOOL)animated {
    [self resignFirstResponder];
    [super viewWillDisappear:animated];

Reference PAGE TOP


0 Comments Leave a comment

Please login in order to leave a comment.

Newest first

to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.