在摇动iPhone设备我想要一些功能被调用,我不知道如何识别摇,所以我尝试了一些链接,并尝试了这个代码
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if(event.type == UIEventSubtypeMotionShake)
{
NSLog(@"called");
[self.view setBackgroundColor:[UIColor greenColor]];
}
}
- (BOOL)canBecomeFirstResponder
{
return YES;
}
但唉没有运气所以你能告诉我如何做同样的事情
感谢致敬