tags:

views:

170

answers:

1

I haven't had any experience with the accelerometer yet and i was wondering how i would move my UIImageView with the accelerometer, can anyone point me to any tutorials or give me a little help? thanks, harry

+1  A: 

There are a collection of tutorials here http://www.iphonedevforums.com/forum/sdk-coding-help/854-how-use-accelerometer.html which should meet your needs.

//viewDidLoad
UIAccelerometer *accel = [UIAccelerometer sharedAccelerometer];
accel.delegate = self;
accel.updateInterval = 1.0f/60.0f;

//then
- (void)accelerometer:(UIAccelerometer *)acel didAccelerate:(UIAcceleration *)aceler {
//move your image here
//based on aceler.x aceler.y aceler.z
}
Andiih