Portrait orientation for iPad only?

According to the apple, my application should work in both portrait modes. How to do this with shouldAutorotateToInterfaceOrientation ??

+3
source share
4 answers

Just return YES regardless of the orientation of the interface. This will allow you to autorotate the system with an inverted orientation.

If you do not want to support landscape orientations, return:

return UIInterfaceOrientationIsPortrait(interfaceOrientation);
+8
source

This code allows any orientation except terrain:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
    return (orientation != UIDeviceOrientationLandscapeLeft) &&
           (orientation != UIDeviceOrientationLandscapeRight);
}
+6
source

. (Home Button Down).

" Apple iOS, App Store.

, , .

, , , , , . , , "" ".

. 1)

 `- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}

2) info.plist, UILaunchImageFile & insert value as Default-Portrait.png

3) Default.png Default-Portrait.png Default-PortraitUpsideDown.png( 180 )

.

make sure you use UIInterfaceOrientationIsPortrait (interfaceOrientation) in all view controllers within the application, if required. also clean before starting.

+1
source

Use this.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
+1
source

Source: https://habr.com/ru/post/1742995/


All Articles