To convert our app from portrait into landscape, we have to do three things:
1 Make the view from BullsEyeViewController.xib landscape instead of portrait.
2 Change one line of code in BullsEyeViewController.m that will allow the view controller to autorotate to landscape mod.
3 Change the "Supported Device Orientations" settings of our app.
in iOS 5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
This particular piece of functionality is queried by UIKit when the user rotates his iPhone. UIKit essentially asks the view controller: "Do you want to rotate to this new orientation?"
YES NO
if only allow for landscape, change
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)êinterfaceOrientation
{
return
UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
cmd left or right change the orientation in simulator
To change the initial orientation