Questions tagged [uiaccelerometer]

The UIAccelerometer class lets you register to receive acceleration-related data from the onboard hardware. As a device moves, its hardware reports linear acceleration changes along the primary axes in three-dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. Deprecated in iOS 5.0. Available in iOS 2.0 and later.

Deprecated in iOS 5.0. Available in iOS 2.0 and later. The UIAccelerometer class lets you register to receive acceleration-related data from the onboard hardware. As a device moves, its hardware reports linear acceleration changes along the primary axes in three-dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. You might use instantaneous changes as input to a game or to initiate some action in your application.

You do not create accelerometer objects directly. Instead, you use the shared UIAccelerometer object to specify the interval at which you want to receive events and then set its delegate property. Upon assigning your delegate object, the accelerometer object begins delivering acceleration events to your delegate immediately at the specified interval. Events are always delivered on the main thread of your application.

The maximum frequency for accelerometer updates is based on the available hardware. You can request updates less frequently but cannot request them more frequently than the hardware maximum. Once you assign your delegate, however, updates are delivered regularly at the frequency you requested, whether or not the acceleration data actually changed. Your delegate is responsible for filtering out any unwanted updates and for ensuring that the amount of change is significant enough to warrant taking action.

For more information about the data delivered to your observer, see UIAcceleration Class Reference. For information about implementing your delegate object, see UIAccelerometerDelegate Protocol Reference.

113 questions
1
vote
1 answer

UIAccelerometer and UIScrollView

I want to scroll a scrollview based on the UIAccelerometer values. What is the best way to accomplish this? My main problem is that using the accelerometer values, I cannot set a content offset. Because the scrollview itself scrolls using a…
1
vote
0 answers

Find Units of each sensors in CMMotionManager in iphone

There is any in build method to know the Units of each sensor values? Im trying to find the value for Acceleration Magnitude. We have any inbuild method to find it out or i can follow the following formula? (√(Accelx2+Accely2+Accelz2))/…
siva
  • 1,402
  • 2
  • 14
  • 28
1
vote
1 answer

How to get user's step count in using accelerometer data?

I want to calculate user steps(like pedometer).I know that with iPhone 5s, 6 and 6+ we can use CMStepCounter or CMPedometer class(which use M7 chip of devices) but iPhone 5 and lower versions does not support M7 chip, so we can't use CoreMotion. By…
Bharat
  • 2,987
  • 2
  • 32
  • 48
1
vote
2 answers

iPhone accelerometer:didAccelerate: seems to not get called while I am running a loop

An accelerometer related question. (Sorry the formatting may not look right, its the first time I am using this site). I got the accelerometer working as expected using the standard code UIAccelerometer *accel = [UIAccelerometer…
AJJ
  • 11
  • 3
1
vote
1 answer

How to detect shake Gesture in your iPhone Cocos2D? in iOS 8

My cocos2d app have shake feature, I develop shake feature using UIAccelerometer. In iOS 8 UIAccelerometer meter is not working. Can any one help me, How to detect shake Gesture in cocos2d app. Thanks....
Sudhakar
  • 1,517
  • 1
  • 10
  • 22
1
vote
1 answer

how to detect iphones loss of velocity

How can you use the accelerometer to detect if the phone has come to a halt. In my case iw want to use it for, i'd like to detect whether its changed direction on the same axis ( a u-turn) which would involve the device stopping. Any ideas…
Sam Jarman
  • 7,277
  • 15
  • 55
  • 100
1
vote
2 answers

Possible to receive UIAccelerometer updates when app is inactive?

When my iPhone app resigns active status, the sharedAccelerometer singleton instance of UIAccelerometer stops sending accelerometer:didAccelerate: messages to my delegate. Is it at all possible to continue receiving those messages, similarly to how…
user226386
1
vote
2 answers

UIAccelerometer doesn't send events to second delegate

I am developing a game that uses a different controller for each level. It needs to detect a shake via the accelerometer, so it registers itself as a delegate like so: UIAccelerometer *accel = [UIAccelerometer sharedAccelerometer]; accel.delegate =…
Bdebeez
  • 3,542
  • 3
  • 31
  • 32
1
vote
3 answers

Multiple UIView instance doesn't work

I have subclass UIView class in a Bounce class with Accelerometer. This Bounce class show an image and move it on the screen. When the iPhone device is moved, this image Bounce on the screen. When I create multiple instance, only last instance work…
Undolog
  • 562
  • 2
  • 9
  • 20
1
vote
1 answer

UIAccelleration value range

The AppleDeveloper guide seem to imply that UIAccelerationValue can range between a double value of -1.0 and +1.0. I have logged the values from a real device whilst "shaking" with crazy gestures my iPod touch and got x values above 2.0 (e.g. +2.1,…
mm24
  • 9,280
  • 12
  • 75
  • 170
1
vote
1 answer

is IPad accelerometer normalized to gravity

While porting my Android app to iOS I was confused with one thing, so I want to find out: am I right or mo code works wrong. At Android device accelerometer returns values in physical measure units: m/s2. On ipad i get summary force approximately =…
Maep
  • 833
  • 1
  • 10
  • 16
1
vote
1 answer

G-Force Calculation

I have used this code to get the G-Force value. But the problem is When I keep my iPhone on table still it show 0.99 value.Can any one tell me the reason? Code is sx = acceleration.x * kFilteringFactor + sx * (1.0 - kFilteringFactor); sy =…
SRI
  • 1,514
  • 21
  • 39
1
vote
1 answer

Calculate G Value from UIAccelerometer in xcode

I have written this code to get the G value from UIAccelerometer in xcode. Could you tell me is it correct or not? -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { float gValue =…
SRI
  • 1,514
  • 21
  • 39
1
vote
0 answers

moving object with Accelerometer value in iphone?

am developing one application using UIAccelerometer , and i retrived the x,y, z values . i need to mive one object (consider UIImageView) using these values. here is my code UIAccelerometer *accel = [UIAccelerometer sharedAccelerometer]; …
Vishnu Raj
  • 61
  • 8
1
vote
0 answers

Detect iPhone accelerometer inactivity

How do I check if the iPhone is not shaken for a specific time? My app will support iOS 5.x and I heard accelerometer is depreciated in iOS 5.0. Can I detect inactivity in CoreMotion framework? Please help me to solve this.. Thanks in advance.
MGP
  • 31
  • 3