how to make an image appear everytime when i shake my iphone
- by Abhishek
Hello,
i have created a shake application in iphone but i am having a problem. I want that when i shake my iphone everytime an image should appear for every shake.Can anybody help how is it possible.
This is the code which i have written:
CGRect myImageRect = CGRectMake(110.0f, 70.0f, 220.0f, 380.0f);
//This line is for setting my tick.png image on my image view
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:[UIImage imageNamed:@"tick_mark.png"]];
[self.view addSubview:myImage];
//animation
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[myImage setAlpha:0.0];
[UIView commitAnimations];
[myImage release];
This is for beginning animations and I have set my image alpha to 0.0 so that my image will disappear. This code is working properly. But I want it so that when I shake my iPhone again my image should reappear for every shake. How is it possible.