How to detect iphone shake gesture one time !

心已入冬 提交于 2020-01-03 03:40:08

问题


hi i want iphone detect shake gesture only one time .

after iphone had been shaken and html files showed , then i want iphone doesn't detect shake anymore .

here is my code :

- (void)accelerometer:(UIAccelerometer *)accelerometer 
        didAccelerate:(UIAcceleration *)acceleration {
    {
        if (acceleration.x > kAccelerationThreshold 
            || acceleration.y > kAccelerationThreshold
            || acceleration.z > kAccelerationThreshold) {


        }
    }
}

回答1:


Remove the delegate:

[UIAccelerometer sharedAccelerometer].delegate = nil;


来源:https://stackoverflow.com/questions/1755225/how-to-detect-iphone-shake-gesture-one-time

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!