How to detect the shaking method detect in xcode4 and开发者_C百科 that method displays NSLog,
spacially i used xcode4 and detect the method of the shaking in simulator of xcode,
hoe to shake iphone simulator.
pls help,
Your regards
Thanks in Advance.
To detect the shake in your code you should use something like:
-(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if(motion == UIEventSubtypeMotionShake)
{
NSLog(@"DID SHAKE DEVICE");
}
}
To simulate the shake gesture in the Simulator go to Hardware -> Shake Gesture
精彩评论