Latest iPhone News, iPhoneTopic.com

Latest iPhone News

Last updated: 9. February, 2010 - Tuesday     topic : 17,783 view : 2,814,650

 

iPhone Accessories

iPhone Books Store

iPhone Screen Protector

iPhone Information

iPhone Tips

iPhone FAQ


Hot Mobile Phone


Mobile Phone Reviews


HDTV


Resource News


iPhone Coding: Using the Accelerometer


10 Sep 2007    view : 11,228

 

Filed under: iPhoneYou don't need to use a lot of fancy routines to subscribe to data generated by the iPhone's built in accelerometer. A single UIApplication delegate lets you know whenever the iPhone has updated its tilt data. When you add a method for (void)acceleratedInX:(float)xx Y:(float)yy Z:(float)zz to any UIApplication, the iPhone sends regular messages to your application giving you values for X, Y, and Z. These values are not exactly what I first expected: X = Roll X corresponds to roll, or rotation around the axis that runs from your home button to your earpiece. Values vary from 0.5 (rolled all the way to the left) to -0.5 (rolled all the way to the right). Y = Pitch. Place your iPhone on the table and mentally draw a horizontal line about half-way down the screen. That's the axis around which the Y value rotates. Values go from 0.5 (the headphone jack straight down) to -0.5 (the headphone jack straight up). Z = Face up/face down. I expected the Z value to correspond to yaw. And it does not. It refers to whether your iPhone is face up (-0.5) or face down (0.5). When placed on it side, either the side with the volume controls and ringer switch, or the side directly opposite, the Z value equates to 0.0.Continue reading iPhone Coding: Using the AccelerometerRead | Permalink | Email this | Comments

Read more..

Latest iPhone Articles

Apple iPhone News Update

Apple iPhone Hot! News

Latest iPhone News

Most Popular iPhone News

iPhone Topic is an independent resource for all things iPhone and beyond.
iPhone and the Apple logo are the property of Apple Computer, Inc.

 

Copyright © 2007 - 2010 iPhone Topic All rights reserved.