我正在开发一个带有手势系统的应用程序,基本上,如果我把iPhone转到左边,我的应用程序会做一个功能,如果我把iPhone转到右边,其他功能,和其他手势。
我不知道如何使用它,我尝试在谷歌搜索,但没有工作,结果只是触摸手势,而不是运动手势。
有没有人有教程可以帮我?
发布于 2018-02-02 14:04:47
Speedy99的快速答案是在Objective C版本中
- (void)viewDidLoad {
[super viewDidLoad];
[self becomeFirstResponder];
}
- (BOOL)canBecomeFirstResponder{
return true;
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event{
if(event.subtype == UIEventSubtypeMotionShake){
NSLog(@"Why are you shaking me?");
}
}https://stackoverflow.com/questions/33503531
复制相似问题