How can I rotate an image in response to the iPhone's accelerometer?

后端 未结 2 1363
清歌不尽
清歌不尽 2021-01-13 22:22

hai , i use accelerometer to rotate uiimageview through device orientation like UIInterfaceOrientationLandscapeRight,etc. if i dont use device orientation,(if i put iphone

相关标签:
2条回答
  • 2021-01-13 23:03

    In this code sample provided by Apple they use the accelerometer to adjust the orientation of an image in the center of the screen. Hopefully this sample code will help you find what you need. (You will need access to the Apple developer site to download this code sample)

    oalTouch Sample

    Cheers-

    0 讨论(0)
  • 2021-01-13 23:20

    You could also use a combination of CGAffineTransforms on the view itself. These matrices act to transform a view by rotation or translations. You can even animate the process if you like. If this is what you're actually trying to do, I can provide some sample code.

    0 讨论(0)
提交回复
热议问题