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
0
votes
1 answer

Find 2nd Derivative of Acceleration - UIAccelerate

Hi I'm working on an iOS app that requires finding the z value of the accelerometer and then deriving it twice of find the "Jounce" value. Heres what I have so far: In -(void)accelerometer:(UIAccelerometer *)accelerometer…
virindh
  • 3,775
  • 3
  • 24
  • 49
0
votes
1 answer

Accelerometer detecting side to side movements - instant detection of change in direction

Id have an app that does one thing if you shake it one way, and another if you shake it the other. atm my code is. if (acceleration.x > 1.5) { //arm to the right when facing you float duration = ([imageArray count]*0.04); //HUMAN EYE…
Sam Jarman
  • 7,277
  • 15
  • 55
  • 100
0
votes
1 answer

moving a ball in a grid xcode

I am trying to build an iphone app which has a grid of 5 columns up and down and 8 rows back and forth. I want to have a ball be able to traverse on these continuously. I'm sure there must be some way to do this that is already figured out and if…
user1114881
  • 731
  • 1
  • 12
  • 25
0
votes
1 answer

How to get iPhone Device Activity

I want to get whether iPhone device is stationary, walking, In car etc. Can I get it through Core Motion Framework? CMAcceleration only gives x, y and z values. How to use this value to calcluate iPhone Device Activity
Bhumeshwer katre
  • 4,671
  • 2
  • 19
  • 29
0
votes
0 answers

How to detect iPhone's movement across while taking panorama images?

How can we detect across movement of an iPhone while taking panorama image? NOTE: I am developing a custom panorama app and need to detect this movement to take panorama image. Please let me know.
meetpd
  • 9,150
  • 21
  • 71
  • 119
0
votes
1 answer

ios cmmotionanager memory usage

I followed this tutorial: http://blogs.captechconsulting.com/blog/john-morrison/ios-getting-started-accelerometer-data to get my iPhone app to listen to the accelerometer. Added the CMMotionManager to my AppDelegate, and added a property to read…
0
votes
1 answer

Cocos2d for iOS: Gyroscope vs UIAccelleration

I have implemented a space shooter game project with Cocos2d 2.0 and a UIAccelleration controller. The UIAccelleration as some drawbacks: it requires calibration it depends on actual accelleration and hence it could lead to loose sensitivity as it…
mm24
  • 9,280
  • 12
  • 75
  • 170
0
votes
1 answer

Using UIAccelerometer to create a level app

Is there a framework or example code out there that shows how to use UIAccelerometer to control an onscreen level, similar to the bubble level apps? I realize I need to use it like: UIAccelerometer *accel = [UIAccelerometer…
Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
0
votes
2 answers

Accelerometer didAccelerate delegate method not getting called in iOS sdk 6.0

I am developing application to get threshold how forcefully user shook iOS device. I am using iOS sdk 6.0. I tried UIResponder delegate method motionEnded:: It get called when device is shaken but do not give enough data that how forcefully some one…
abdus.me
  • 1,819
  • 22
  • 34
0
votes
1 answer

Is it possible to set UIAccelerometer delta?

I am writing a game on iOS and I am trying to setup the response movement using the accelerometer. So when I start the game on the iPhone, everything is fine and accelerometer is responding without a problem. But when I stop the game loop (pause…
Setrino
  • 341
  • 4
  • 9
0
votes
2 answers

UIAccelerometerDelegate: can i have two objects to handle DidAccelerate event?

I am porting my android App to iOS, and have a little trouble with accelerometer. I want to have two different classes, that have DidAccelerate implementation. I make two objects, each becomes a delegate for UIAccelerometer. But only one object -…
Maep
  • 833
  • 1
  • 10
  • 16
0
votes
2 answers

find out the force in iPhone

I have to develop an application. Requirement is given below. I have to put an indicator like speedometer in the bike. iPhone is put in the corner of a Car. The iPhone is in a placed in a car, from where it can't be dropped anywhere and can't be…
sagarkothari
  • 24,520
  • 50
  • 165
  • 235
0
votes
1 answer

Retain an ivar that holds a pointer to [UIAccelerometer sharedAccelerometer]?

I'm using manual reference counting and Xcode 4.5. I declared an ivar: UIAccelerometer *accelerometer; accelerometer was NOT a property. And I had this code in one method: accelerometer = [UIAccelerometer sharedAccelerometer]; accelerometer.delegate…
RobertL
  • 14,214
  • 11
  • 38
  • 44
0
votes
1 answer

UIAccelerometer distance calculation

I have used the following code to calculate the distance when the device moved from one place to another.Is it correct or not please look at my code. -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration…
SRI
  • 1,514
  • 21
  • 39
0
votes
1 answer

convert UIAccelerometer data into Degree in iPhone?

any idea how to turn the accelerometer data into degrees? i have developed an accelerometer application and i need to get the values in degree? UIAccelerometer *accel = [UIAccelerometer sharedAccelerometer]; accel.delegate = self; …
Neeraj Neeru
  • 570
  • 8
  • 28