The problem of converting my project from portrait to landscape orientation

I designed my project in portrait orientation, now I want to adjust the orientation of the project in the landscape. I set all the xib file orientation properties as terrain, and in .plist I also set all elements of the supported interface orientations as terrain, but when I start my project, one view still comes in portrait orientation ... in this view, I show the pdf file.

Thanks in advance!

+3
source share
2 answers

Have you added the following method to the controller:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return YES;
}
+2
source

if Landscape uses this code

(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight);
}

if the portrait uses this code

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

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


All Articles