工程添加摇一摇方法
#pragma mark yaoyiyao
- (BOOL)canBecomeFirstResponder
{
return YES;// default is NO
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
//处理摇一摇之后响应的事件
//添加震动功能
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
//添加手机响铃的方法
SystemSoundID soundId;
NSString *path = [[NSBundle mainBundle]pathForResource:@“song” ofType:@"avr"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &soundId);
AudioServicesPlaySystemSound(soundId);
}