TAP THE FISH!

TAP THE FISH!
TAP THE FISH!

giovedì 8 aprile 2010

IMPARANDO "SDK" (Shake)

Per determinare quando il telefono viene "agitato" si può utilizzare il seguente codice:

Nel vostro file .h

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event;


Nel vostro file .m

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {

if (event.type == UIEventSubtypeMotionShake) {

//Cosa faccio se mi agiti?

//Scrivilo qui.

}

}


-(BOOL)canBecomeFirstResponder {

return YES;

}


-(void)viewDidAppear:(BOOL)animated {

[super viewDidAppear:animated];

[self becomeFirstResponder];

}


- (void)viewWillDisappear:(BOOL)animated {

[self resignFirstResponder];

[super viewWillDisappear:animated];

}



...come al solito molte linee non le comprendo appieno però sono tutte necessarie...

Nessun commento:

Posta un commento