title: CMAccelerometerData class Vs. deprecated UIAccelerometer class
body: <p>Based on <a href="http://developer.apple.com/library/ios/#documentation/CoreMotion/Reference/CMAccelerometerData_Class/Reference/Reference.html" rel="nofollow noreferrer">this</a> documentation, the <strong>CMAccelerometerData class</strong> (found in the Core Motion framework) has a property of type <strong>CMAcceleration</strong> called <em><strong>acceleration</strong></em> that is a typedef of a struct containing 3 values (double x, double y, double z)</p>
  <p>I'm rather new to Objective-C (I only know C++..) so my question is this : How do I access, let's say the <em>double y</em> value kept in that property, at some point during my code?</p>
  <p>Do I first create an instance of the CMAccelerometerData class like this :</p>
  <pre><code>CMAccelerometerData *myAccelerometer;
  </code></pre>
  <p>then access its acceleration property :</p>
  <pre><code>double axisYvalue = [myAccelerometer acceleration]; 
  </code></pre>
  <p>the above is obviously wrong, isn't it? I have to get the Y found in acceleration specifically so how do I do that?</p>
  <pre><code>double axisYvalue = [myAccelerometer acceleration-&gt;y]; // no this is wrong as well..
  </code></pre>
  <p>so how do I do it?</p>
  <p>And one last question if I may :)</p>
  <p>given this specific class and property that I mentioned.. and let's say I've instantiated my CMAccelerometer class.. Now every time, during my code, I use something like</p>
  <pre><code>return [myAccelerometer acceleration-&gt;y]; // let's say that's the correct version :)
  </code></pre>
  <p>inside some -(double) method .. will I be getting the value of the Y-axis at <em><strong>that</strong></em> specific moment in which the call is being made ?</p>
  <p>I am asking this because I got confused when reading about the now deprecated UIAccelerometer class where you had to define intervals and update the values of x,y,z every so often etc..
  where as now I can get the value that is being exercised on the Y-axis the moment the call to the acceleration property is made, isn't that the case?</p>
  <p>phew... sorry for the length of this text! :)</p>