Can anyone give an example of how to rotate the view of a monotouch application from portrait to landscape and vice versa?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
- XCode 4.5 giving me “SenTestingKit/SenTestKit.h” f
Just so everyone knows, it is now on the views Transform object:
For all you dotnet guys like me that don't want to use anything that is CGAffineTransform, thinking it will break other things, just try it. Worked great for my instance. Rotated the NavigationController.View and everything inside it is perfect.
If you set the geometry of your ui elements in Interface Builder, then make sure you set the Autosizing attributes in the Size Inspector (Cmd+3). You can then see how the view will look after rotating by clicking the little "Rotate" button in the upper left of the title bar of your view in Interface Builder.
Once you have all that set up, just override the following method in your ViewController:
Now in the simulator, you can rotate all you want and your UI will auto-adapt.
This is what you can try out.
If you want to change the orientation of the view while touching on the view , then follow the steps
Implement the touchesBegan method inside the view.
In the touchesBegan method check the current device orientation,
[[UIDevice currentDevice] orientation];
If you want to change the orientation then use the CGAffineTransformation method on the view as
viewRef.transform = CGAffineTransformMakeRotation(angle);