アプリ全体にシェイク機能を統合したい。だから私はappDelegateですべてをやっています。viewControllerをプッシュする必要があります。motionBeganをプッシュできますが、motionEndedを実行したかったのです。はいモーション終了はViewControllerで機能しますが、アプリデリゲートでは呼び出されません。として行う
- (void)applicationDidBecomeActive:(UIApplication *)application {
[self becomeFirstResponder];
}
- (BOOL)canBecomeFirstResponder{
return YES;
}
motionEndedは呼び出されません
-(void) motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if(event.subtype==UIEventSubtypeMotionShake){
NSLog(@"motionEnded called");
}
}
motionBeginが呼び出されました
-(void) motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if(event.subtype==UIEventSubtypeMotionShake){
NSLog(@"motionBegan called");
}
}