我的 viewcontroller.m 里面有这个
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (event.type == UIEventSubtypeMotionShake) {
NSLog(@"shake shake shake");
}
}
- (void)viewDidLoad
{
[self performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.3];
}
但是当我摇晃手机时,什么也没有发生。为什么?