ios - Obtain g-force from accelerometer readings -


I want a label that shows the current active force facing the iPhone. I have a code to get information from the accelerometer, but I do not know how to send data to a label to show the current G. force. I have my code here ...

  ! Administrator) {self.manager = [CMMotionManager new]; } If (the administrator of. Accelerometer activated) {[Self. Admin stop accelerator update]; } NSOperationQueue * queue = [NSOperationQueue new]; [Self. Admin Set Exceror Update DataInternval: 1.0 / 30.0]; // 30 updates per second [Self. Manager type Startaॅkselretrapdets: queue Sathhandlr: ^ (Simakeleromitrdata * Aksilromitrdeta, Ansiarar * error) {Anselog (@ "X:% f y:% F Z:% f", Aksilromitrdata.aksiliareshn.aks, accelerometerData.acceleration. y, accelerometerData.acceleration.z); }];   

Thank you

It is very easy to have an interface builder Uaielbl want to set up and you'll see a property like this:

  @property (strong, nonatomic) IBOutlet UILabel * myLabel;   

After you and your NSLog statement, you need to insert this code:

  self.myLabel.text = [NSString stringWithFormat: @ "x =% F , y =% f, z =% f ", accelerometer data Acceleration. X, accelerometer data. Acceleration. Y, accelerometer data. Acceleration. Z];   

Of course you would like to look good at this, but it should be enough to let you know.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -