Hi all, I am making a simple, tilt controlled game using UIKit. So far, when I tilt the device the character moves in the appropriate direction. What I want him to do is to change the direction he is facing when I tilt the device. For example, when I tilt it left, I want the character to face left. Is there a way to detect whether the device was tilted left or right? If so, could you point me in the right direction please. Thanks, Tate
A:
If knowing the actual rotation is good enough for you. Then I would suggest to use an UIViewController and override - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
method
If you need more stuff then I would suggest to do a search about accelerometer
nacho4d
2010-05-30 18:33:09
Accelerometer tutorial:http://www.switchonthecode.com/tutorials/iphone-tutorial-reading-the-accelerometerUIViewController reference:http://developer.apple.com/iphone/library/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/didRotateFromInterfaceOrientation:
nacho4d
2010-05-30 18:35:24
I needed more of a tilt based control not a full orientation change but thanks for trying.-Tate
Tate Allen
2010-05-30 20:54:58