title: iOS calculate g-force
body: <p>Its simple, I need to make a label in my project that says the current g-force from the accelerometer. I have found some code but I don't know where to put it in my code. I am guessing that I need to put it into a void statement but I am not sure. Please point me in the right direction. </p>
  
  <pre><code>sx = acceleration.x * kFilteringFactor + sx * (1.0 - kFilteringFactor);
  sy = acceleration.y * kFilteringFactor + sy * (1.0 - kFilteringFactor);
  sz = acceleration.z * kFilteringFactor + sz * (1.0 - kFilteringFactor);
  
  float aValue = sqrt(sx*sx+sy*sy+sz*sz);
  
  [gforcelabel setText:[NSString stringWithFormat:@"%.2f",aValue]];
  </code></pre>