How to stop responding to a shake before a button is pressed?
问题 i am currently making a iPhone app, and a animation reacts to a small shake, this is my code: static BOOL SJHShaking(UIAcceleration* last, UIAcceleration* current, double threshold) { double deltaX = fabs(last.x - current.x), deltaY = fabs(last.y - current.y), deltaZ = fabs(last.z - current.z); return (deltaX > threshold && deltaY > threshold) || (deltaX > threshold && deltaZ > threshold) || (deltaY > threshold && deltaZ > threshold); } - (id)initWithFrame:(CGRect)frame { if (self) { //