質問

It is easy to change orientation of the iPad/iPhone simulators by following: hardware->rotate left or right. But, how can I change it on iDevice (iPad device or iPhone device?)

please can somebody help me?

should I add some code? enter image description here

役に立ちましたか?

解決

Go to you summary tab, scroll down the to go "iPad Deployment Info". Unselect all the four options in "Supported Interface Orientations". Then select again, but select Portrait first and remaining after.

enter image description here

Also in View that you are expecting to be in portrait mode, just add

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
    return (orientation == UIInterfaceOrientationMaskAll);
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

Hope this helps.

他のヒント

Go to the .plist file in Supporting Files

There you will see Supported interface orientations Add below keys

Item 0 String Portrait (top home button)
Item 1 String Portrait (bottom home button)
Item 2 String Landscape (left home button)
Item 3 String Landscape (right home button)

enter image description here

a call to UIApplication's setStatusBarOrientation will fake a rotation

Add Initial interface orientation key/value to your $appName-info.plist file

app-info.plist

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top