开发者

Flip the iPhone screen with a button

how do I impl开发者_如何转开发ement a button that will flip the screen 180deg for my game (if the user wishes to play it with the iPhone upside-down), and have it affect all of my 5 different views?


You should apply a transform to the parent view (your UIWindow). The rotation can be made using CGAffineTransformMakeRotation().

It might be better to actually allow the device orientation to cause the rotation though. In App settings set that the app supports autorotation and then in the UIViewController return tru to -(BOOL)shouldAutorotateToInterfaceOrientation when the rotation passed in is UIInterfaceOrientationPortraitUpsideDown


Look at shouldAutorotateToInterfaceOrientation. And maybe [myView setNeedsDisplay]; could help.


It sounds like you just want to use the build in automatic orientation rotation. You may need to tell your app in the build settings that it supports the upsidedown orientation and as dasdom mentioned you need to implement shouldAutorotateToInterfaceOrientation in all of your view controllers.

There is no way to force the phone into an orientation on-demand.

If you are looking to just rotate a view you can apply a CGAffineTransform.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜