4
我想整合應用程序中的搖動功能。所以我正在做一切在AppDelegate。我需要推一個viewController,我可以推動motionBegan,但我想要做motionEnded。 yes motion motion在視圖控制器中工作,但在應用程序委託中它沒有被調用。 做的motionDefined未在appDelegate中調用
- (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");
}
}
motionBegan稱爲
-(void) motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if(event.subtype==UIEventSubtypeMotionShake){
NSLog(@"motionBegan called");
}
}
發佈通知可以幫助我猜 – nsgulliver 2013-03-05 10:48:19
我避難所ot那麼多的通知,我嘗試了applicationDidBecomeActivie中的addedObserver「DeviceShaken」,但沒有收穫 – 2013-03-05 12:11:49
你解決了你的問題嗎?回答有用嗎? – nsgulliver 2013-03-05 16:51:55