#pragma mark yaoyiyao  
- (BOOL)canBecomeFirstResponder  
{  
    return YES;// default is NO  
}  
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event  
{  
    NSLog(@"开始摇动手机");  
}  
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event  
{  
    NSLog(@"stop");  
    UIAlertView *yaoyiyao = [[UIAlertView alloc]initWithTitle:@"温馨提示:" message:@"您摇动了手机,想干嘛?" delegate:self cancelButtonTitle:@"CANCEL" otherButtonTitles: nil nil];  
    [yaoyiyao show];  
}  
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event  
{  
    NSLog(@"取消");  
}  

转自http://blog.csdn.net/hu_songsong/article/details/12981505

 
posted on 2015-08-10 09:52  火星的蝈蝈  阅读(184)  评论(0编辑  收藏  举报