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
2
votes
2 answers

Gravity reading Vs User acceleration reading of the iphone accelerometer?

Iphone accelerometer provides user acceleration and gravity reading? It's clear from the apple guide the user acceleration means, the acceleration than the phone get's from the user. Then what is the meaning of gravity reading? Anyway they have…
sam
  • 259
  • 1
  • 6
  • 22
2
votes
1 answer

How can i know the swinging direction of the ios device in ios programming?

I'm new to IOS programming, I don't know how to judge the swinging direction of a device.And I have searched a long time for this question, but I only find very little about this. Could someone help me? Thanks very much!
Abel_CN
  • 64
  • 6
1
vote
1 answer

Which movements are managed by accelerometer on iOS?

The apple developer documentation explains the handled movement by this image : I'm pretty confused now... because doing some tests i get that the Accelerometer doesn't handle translation on the axis but a little set of rotations ... in example if…
MatterGoal
  • 16,038
  • 19
  • 109
  • 186
1
vote
0 answers

Ball Animation in Landscape mode for iPhone

I'm animating a ball on the screen in portrait mode using UIAccelerometer. It's working fine, now I want the same to work in landscape mode. When I tried to use the same part of code (for portrait) in the landscape mode it gives me a weird result,…
Warrior
  • 39,156
  • 44
  • 139
  • 214
1
vote
0 answers

NSOperationQueue Blocking Main Thread, UIAccelerometerDelegate won't fire

I have a piece of code which calls [NSOperationQueue waitUntilAllOperationsAreFinished], in which the queue, I have placed a sensor detector for the Accelerometer. The accelerometer delegate requires the Main thread in order to respond to…
VerticalEvent
  • 619
  • 1
  • 11
  • 18
1
vote
1 answer

Detecting the direction of the accelerometer movement on the y axis

I currently detect movement on the y axis. How does one calculate the direction it moved on the axis? I get the same values when moving up or down. Is the Gyro needed for this?
user773578
  • 1,161
  • 2
  • 13
  • 24
1
vote
0 answers

How to get the pixel value from the acceleration of UIAccelerometer?

I've calculated the velocity from the acceleration of UIAcceleometer, and I want to move the UIView in opposite of the distance which the device moves but same distance. For example, if I move the device to right, the UIView should go left with the…
1
vote
1 answer

Calibrate Accelerometer?

I see many apps on the app store that have a button like calibrate accelerometer (for example: Doodle Jump) I am looking to implement a similar way to calibrate the accelerometer in my app. I am using the default UIAccelerometer API's and stuff like…
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
1
vote
1 answer

Does iPad have accelerometer or gyro?

I have an iPhone app using these (via UIAccelerometer) - will it work on the iPad?
Doug Null
  • 7,989
  • 15
  • 69
  • 148
1
vote
1 answer

How to find time and speed using iPhone's accelorometer

Let me tell you my physics is very bad. I want to calculate time between two points. The situation here is - if an object is moved from say point x to point y with an acceleration which is not constant, can we calculate the time between those…
Jayshree
  • 281
  • 1
  • 6
  • 28
1
vote
3 answers

How to keep a UIView pointing in a certain direction regardless of device orientation?

I have a UIView that I want to always be facing up. So say you have an UIImageView that has an arrow, and no matter what way the device is being held, it's pointing up. Obviously I need the accelerometer, but telling it to rotate the image based…
Marty
  • 5,926
  • 9
  • 53
  • 91
1
vote
2 answers

Cocos2d shake/accelerometer issue

So I a little backstory. I wanted to implement a particle effect and sound effect that both last about 3 sec or so when the user shakes their iDevice. But first issue arrived when the build in UIEvent for shakes refused to work. So I took the…
Ryan Poolos
  • 18,421
  • 4
  • 65
  • 98
1
vote
0 answers

How to detect Panorama movement in iOS

I have been trying to achieve the animation in this link: http://www.visa.com/rio2016/na-en/#!gallery on an iPad. Try opening this link on and iPad and you'll see. Basically, its a wrapped(360 degree/Infinite) horizontal list. If the user moves in…
nr5
  • 4,228
  • 8
  • 42
  • 82
1
vote
1 answer

Getting level of rotation with UIAccleration

Games like FroggyJump for iPhone figure out the rotation of the iphone. I'm getting confused with the acceleration values. How do I calculate the level of rotation? I suppose I need to consider when the iphone isn't perfectly upright. Thank you.…
Matthew Mitchell
  • 5,293
  • 14
  • 70
  • 122
1
vote
0 answers

How to bring alert message if iPod have not moved for 60min?

My task is to bring an alert message if the device has not been moved for 60 minutes.. Not even single tilt Example: i) To Bring Alert Message: Let us consider iPod has been placed on table for 60 min.. it was not moved at all.. At end of…
Nithya
  • 1,029
  • 2
  • 14
  • 27