当前位置: 首页 > 科技观察

iPhone摇一摇

时间:2023-03-12 17:15:07 科技观察

源码介绍:摇一摇在iPhone上的实现非常简单。详情请参考下方代码或下载demo。源码效果:源码片段:#pragmamark-Shake/***Shakestart*/-(void)motionBegan:(UIEventSubtype)motionwithEvent:(UIEvent*)event{if(motion==UIEventSubtypeMotionShake){NSLog(@"startedtoshake");}}/***Shakeended*/-(void)motionEnded:(UIEventSubtype)motionwithEvent:(UIEvent*)event{NSLog(@"Shakeended");}/***Shakecanceled*/-(void)motionCancelled:(UIEventSubtype)motionwithEvent:(UIEvent*)event{NSLog(@"摇一摇取消");}下载地址:http://down.51cto.com/data/2076086