I have an image of a bottle, whenever user shakes the device i want to move that image in that direction. like up, down, left or right.
For example: if user is shaking the device in left direction i want to move that image in left direction.
i can detect shake event using
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if(event.subtype==UIEventSubtypeMotionShake)
{/*some code*/} }
but i dont know how to detect the direction.
i dont even if this is possible or not. please help me.