Force Calculate using UIAcceleration values in iphone
How to calculate force value of iphone using UIAcceleration values....
Can anyone help me?
What i want is ? When user moves slowly from one region to ot开发者_如何转开发her i want to do some task or they move faster i want to do some other task ....
Can anyone help me ?
Thanks in advance.....
force creates acceleration. if you're really looking for force, you need to account for the mass of the iphone. but I'm just being pedantic here :)
so you want to accomplish different actions based on the acceleration?
what you'll need to do is register yourself as a delegate of UIAccelerator. whenever didAccelerate fires off, it'll give you the [x,y,z] and the timestamp of the event.
so if you care about the X direction, the x property will have the acceleration in gravities (i.e. 1 = 9.8 meters per seconds squared).
you'll need gyroscopes for any more (orientation, etc).
source: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIAcceleration_Class/Reference/UIAcceleration.html
精彩评论