//设置界面为第一响应
-(void)viewDidAppear:(BOOL) animated{
[self.view becomeFirstResponder];
}
//退出清除响应
-(void)viewDidDisappear:(BOOL) animated{
[self.view resignFirstResponder];
}
//摇晃时间开始
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{
//这里只处理摇晃事件
if (motion==UIEventSubtypeMotionShake) {
//开始摇晃了
}
}
#pragma mark 运动结束
-(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event{
if (motion==UIEventSubtypeMotionShake) {
//摇晃结束
}
}